fix time errors in deadline
This commit is contained in:
parent
83b8a772c3
commit
653755d4c9
|
@ -188,7 +188,7 @@ def submitApplication(request, id, email, user_type):
|
||||||
opening = get_object_or_404(Placement, id=data[OPENING_ID],
|
opening = get_object_or_404(Placement, id=data[OPENING_ID],
|
||||||
allowed_batch__contains=[student.batch],
|
allowed_batch__contains=[student.batch],
|
||||||
allowed_branch__contains=[student.branch],
|
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:
|
if not opening.offer_accepted or not opening.email_verified:
|
||||||
raise PermissionError("Placement Not Approved")
|
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],
|
opening = get_object_or_404(Internship, id=data[OPENING_ID],
|
||||||
allowed_batch__contains=[student.batch],
|
allowed_batch__contains=[student.batch],
|
||||||
allowed_branch__contains=[student.branch],
|
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:
|
if not opening.offer_accepted or not opening.email_verified:
|
||||||
raise PermissionError("Internship Not Approved")
|
raise PermissionError("Internship Not Approved")
|
||||||
|
|
|
@ -303,7 +303,7 @@ class StudentViewsTestCase(APITestCase):
|
||||||
|
|
||||||
def test_add_application_placement_deadlinePassed(self):
|
def test_add_application_placement_deadlinePassed(self):
|
||||||
self.placement.deadline_datetime = timezone.now().replace(
|
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()
|
self.placement.save()
|
||||||
# deleted existing application
|
# deleted existing application
|
||||||
self.placement_application.delete()
|
self.placement_application.delete()
|
||||||
|
@ -561,9 +561,7 @@ class StudentViewsTestCase(APITestCase):
|
||||||
student=self.student).count(), 1)
|
student=self.student).count(), 1)
|
||||||
|
|
||||||
def test_add_application_internship_deadlinePassed(self):
|
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)
|
||||||
self.internship.deadline_datetime = timezone.now().replace(hour=0, minute=0, second=0, microsecond=0) - datetime.timedelta(minutes=5)
|
|
||||||
|
|
||||||
self.internship.save()
|
self.internship.save()
|
||||||
# deleted existing application
|
# deleted existing application
|
||||||
self.internship_application.delete()
|
self.internship_application.delete()
|
||||||
|
|
Loading…
Reference in New Issue