Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
## Purpose
_Describe the problem or feature in addition to a link to the issues._

Example:
Fixes # .

## Approach
_How does this change address the problem?_

#### Open Questions and Pre-Merge TODOs
- [ ] Use github checklists. When solved, check the box and explain the answer.

## Learning
_Describe the research stage_

_Links to blog posts, patterns, libraries or addons used to solve this problem_

#### Blog Posts
- [How to Pull Request](https://github.com/flexyford/pull-request) Github Repo with Learning focused Pull Request Template.

4 changes: 2 additions & 2 deletions applications/graphs/controllers.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,11 +309,11 @@ def _convert_order_query_term_to_database_order_object(order_query):


def search_graphs_by_group_ids(request, group_ids=None, owner_email=None, names=None, nodes=None, edges=None, tags=None,
limit=None, offset=None):
limit=None, offset=None, order_by=None):
if group_ids is None:
raise Exception("Atleast one group id is required.")
return db.find_graphs(request.db_session, group_ids=group_ids, owner_email=owner_email, names=names, nodes=nodes,
edges=edges, tags=tags, limit=limit, offset=offset)
edges=edges, tags=tags, limit=limit, offset=offset, order_by=order_by)


def add_graph_to_group(request, group_id, graph_id):
Expand Down
7 changes: 5 additions & 2 deletions applications/users/controllers.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,16 +266,19 @@ def delete_group_member(request, group_id, member_id):
db.delete_group_to_user(request.db_session, group_id=group_id, user_id=member_id)
return

def search_group_graphs(request, group_id, owner_email, names=None, nodes=None, edges=None, limit=20, offset=0, order='asc', sort='name'):
sort_attr = getattr(db.Graph, sort if sort is not None else 'name')
orber_by = getattr(db, order if order is not None else 'desc')(sort_attr)

def search_group_graphs(request, group_id, owner_email, names=None, nodes=None, edges=None, limit=20, offset=0):
total, group_graphs = graphs.controllers.search_graphs_by_group_ids(request,
group_ids=[group_id],
owner_email=owner_email,
names=names,
nodes=nodes,
edges=edges,
limit=limit,
offset=offset)
offset=offset,
order_by=orber_by)
return total, group_graphs


Expand Down
9 changes: 8 additions & 1 deletion applications/users/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -751,6 +751,10 @@ def _get_group_graphs(request, group_id):
Search for graphs with the given node names. In order to search for graphs with either of the given node names as a substring, wrap the node name with percentage symbol. For example, %xyz% will search for all graphs with xyz in their node names.
edges : list of strings
Search for graphs with the given edges. An edge can be represented as <head_node_name>:<tail_node_name>. In order to perform a substring on edges, wrap the node names with percentage symbol. For example, %xyz%:%abc% will search for all graphs with edges between nodes with xyz in their node names to nodes with abc in their node name.
order : string
Defines the column sort order, can only be 'asc' or 'desc'.
sort : string
Defines which column will be sorted.

Parameters
----------
Expand Down Expand Up @@ -785,7 +789,10 @@ def _get_group_graphs(request, group_id):
nodes=nodes if nodes is None or isinstance(nodes, list) else [nodes],
edges=edges if edges is None or isinstance(edges, list) else [edges],
limit=request.GET.get('limit', 20),
offset=request.GET.get('offset', 0))
offset=request.GET.get('offset', 0),
order=request.GET.get('order', 'asc'),
sort=request.GET.get('sort', 'name')
)

return {
'total': total,
Expand Down