Skip to content
This repository was archived by the owner on Aug 29, 2023. It is now read-only.

Commit c6ce1a6

Browse files
solved a minute bug in the models file and improved the api logic
1 parent a4d13f7 commit c6ce1a6

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed
30 Bytes
Binary file not shown.

rewards/models.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,12 +111,14 @@ def get_videos_by_country(self):
111111
# If the user has 0 watched videos but there is remaining time until the next reset,
112112
# return an empty list of videos to indicate that the user needs to wait for the reset.
113113
return []
114-
else:
114+
elif self.videos_watched == 0 and remaining_reset_time < timezone.timedelta():
115115
# Reset the videos_watched count to the default value (20)
116116
self.videos_watched = 20
117117
# Set the last_watched time to the current time since the videos have been reset
118118
self.last_watched = timezone.now()
119119
self.save()
120+
else:
121+
pass
120122

121123
country = self.user.profile.country
122124
videos = Videos.objects.filter(

0 commit comments

Comments
 (0)