Skip to content

Commit

Permalink
Merge pull request #8939 from archesproject:8916_update_rel_res_pagin…
Browse files Browse the repository at this point in the history
…ation

Update related resource pagination, #8916
  • Loading branch information
robgaston authored Sep 1, 2022
2 parents d931c5a + 3c9201a commit 08caa8e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions arches/app/models/resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -558,8 +558,9 @@ def get_localized_descriptor(document, descriptor_type):
ret = {"resource_instance": self, "resource_relationships": [], "related_resources": [], "node_config_lookup": graph_lookup}

if page > 0:
limit = settings.RELATED_RESOURCES_PER_PAGE
start = limit * int(page - 1)
number_per_page = settings.RELATED_RESOURCES_PER_PAGE
start = number_per_page * int(page - 1)
limit = number_per_page * page

def get_relations(resourceinstanceid, start, limit, resourceinstance_graphid=None):
final_query = Q(resourceinstanceidfrom_id=resourceinstanceid) | Q(resourceinstanceidto_id=resourceinstanceid)
Expand Down

0 comments on commit 08caa8e

Please sign in to comment.