Skip to content

Commit

Permalink
fix: Small bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
annehaley committed Aug 2, 2024
1 parent 6e0e132 commit 87279bc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions uvdat/core/models/networks.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ def get_graph(self):
def get_gcc(self, exclude_nodes):
graph = self.get_graph()
graph.remove_nodes_from(exclude_nodes)
if graph.number_of_nodes == 0 or nx.number_connected_components(graph) == 0:
return []
gcc = max(nx.connected_components(graph), key=len)
return list(gcc)

Expand Down
3 changes: 2 additions & 1 deletion uvdat/core/rest/chart.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ class ChartViewSet(GenericViewSet, mixins.ListModelMixin):
serializer_class = ChartSerializer

def get_queryset(self, **kwargs):
context_id = kwargs.get('context')
request = self.request
context_id = request.query_params.get('context')
if context_id:
return Chart.objects.filter(context__id=context_id)
return Chart.objects.all()
Expand Down

0 comments on commit 87279bc

Please sign in to comment.