fix time errors in deadline

This commit is contained in:
karthikmurakonda 2023-10-11 07:56:06 +05:30
parent 83b8a772c3
commit 653755d4c9
2 changed files with 4 additions and 6 deletions

View File

@ -188,7 +188,7 @@ def submitApplication(request, id, email, user_type):
opening = get_object_or_404(Placement, id=data[OPENING_ID],
allowed_batch__contains=[student.batch],
allowed_branch__contains=[student.branch],
deadline_datetime__gte=datetime.datetime.now().date()
deadline_datetime__gte=timezone.now()
)
if not opening.offer_accepted or not opening.email_verified:
raise PermissionError("Placement Not Approved")
@ -209,7 +209,7 @@ def submitApplication(request, id, email, user_type):
opening = get_object_or_404(Internship, id=data[OPENING_ID],
allowed_batch__contains=[student.batch],
allowed_branch__contains=[student.branch],
deadline_datetime__gte=datetime.datetime.now().date()
deadline_datetime__gte=timezone.now()
)
if not opening.offer_accepted or not opening.email_verified:
raise PermissionError("Internship Not Approved")

View File

@ -303,7 +303,7 @@ class StudentViewsTestCase(APITestCase):
def test_add_application_placement_deadlinePassed(self):
self.placement.deadline_datetime = timezone.now().replace(
hour=0, minute=0, second=0, microsecond=0) - datetime.timedelta(minutes=5)
hour=0, minute=0, second=0, microsecond=0)
self.placement.save()
# deleted existing application
self.placement_application.delete()
@ -561,9 +561,7 @@ class StudentViewsTestCase(APITestCase):
student=self.student).count(), 1)
def test_add_application_internship_deadlinePassed(self):
# now minus 5 minutes
self.internship.deadline_datetime = timezone.now().replace(hour=0, minute=0, second=0, microsecond=0) - datetime.timedelta(minutes=5)
self.internship.deadline_datetime = timezone.now().replace(hour=0, minute=0, second=0, microsecond=0)
self.internship.save()
# deleted existing application
self.internship_application.delete()