Advertisement
horozov86

6. Gym Session

Dec 8th, 2023
626
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.72 KB | None | 0 0
  1. # 6.    Gym Session
  2.  
  3. @classmethod
  4. def get_long_and_hard_exercises(cls):
  5.     query = Q(duration_minutes__gt=30) & Q(difficulty_level__gte=10)
  6.     return cls.objects.filter(query)
  7.    
  8. @classmethod
  9. def get_short_and_easy_exercises(cls):
  10.     query = Q(duration_minutes__lt=15) & Q(difficulty_level__lt=5)
  11.     return cls.objects.filter(query)
  12.    
  13. @classmethod
  14. def get_exercises_within_duration(cls, min_duration: int, max_duration: int):
  15.     return cls.objects.filer(duration_minutes__range(min_duration, max_duration))
  16.  
  17. @classmethod
  18. def get_exercises_with_difficulty_and_repetitions(min_difficulty: int, min_repetitions: int):
  19.     return cls.objects.filter(difficulty_level__gte=min_difficulty, repetitions__gte=min_repetitions)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement