Skip to content

Commit

Permalink
Merge pull request #29 from Seshat-Global-History-Databank/avoid-dupl…
Browse files Browse the repository at this point in the history
…icates

Ensure get_all function doesnt add the same API result more than once
  • Loading branch information
edwardchalstrey1 authored Dec 5, 2024
2 parents 3b3e958 + 80ed335 commit 68f4029
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion seshat_api/base_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,9 @@ def get_all(self):
results = response.get('results', [])
if not results:
break
all_results.extend(results)
for result in results:
if result['id'] not in [r['id'] for r in all_results]:
all_results.append(result)
page += 1

return all_results

0 comments on commit 68f4029

Please sign in to comment.