Skip to content

Commit

Permalink
fix #189; ask API only for submission if there are any assignments
Browse files Browse the repository at this point in the history
  • Loading branch information
C0D3D3V committed Mar 29, 2023
1 parent 7404836 commit 2b0a26b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions moodle_dl/moodle/mods/assign.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,12 @@ async def add_foreign_submissions(self, assignments: Dict[int, Dict[int, Dict]])
return

# get submissions of all students for all assignments (only teachers can see that)
indexed_assignment_ids = self.get_indexed_ids_of_mod_instances(assignments)
if len(indexed_assignment_ids) == 0:
return

assignments_with_all_submissions = (
await self.client.async_post(
'mod_assign_get_submissions', {'assignmentids': self.get_indexed_ids_of_mod_instances(assignments)}
)
await self.client.async_post('mod_assign_get_submissions', {'assignmentids': indexed_assignment_ids})
).get('assignments', [])

if len(assignments_with_all_submissions) == 0:
Expand Down
2 changes: 1 addition & 1 deletion moodle_dl/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '2.3.1.6'
__version__ = '2.3.1.7'

0 comments on commit 2b0a26b

Please sign in to comment.