1
0
mirror of https://gitlab.com/animath/si/plateforme.git synced 2025-06-21 01:58:23 +02:00

Reduce the usage of sync_to_async

Signed-off-by: Emmy D'Anello <emmy.danello@animath.fr>
This commit is contained in:
Emmy D'Anello
2023-04-04 15:10:28 +02:00
parent 4357d51b9a
commit 82cda0b279
3 changed files with 122 additions and 91 deletions

View File

@ -405,6 +405,10 @@ class Pool(models.Model):
return sum(passage.average(participation) for passage in self.passages.all()) \
+ sum(tweak.diff for tweak in participation.tweaks.filter(pool=self).all())
async def aaverage(self, participation):
return sum([passage.average(participation) async for passage in self.passages.all()]) \
+ sum([tweak.diff async for tweak in participation.tweaks.filter(pool=self).all()])
def get_absolute_url(self):
return reverse_lazy("participation:pool_detail", args=(self.pk,))