fixed logic in StudentAcceptoffer
This commit is contained in:
parent
17299b1861
commit
8518bf0ba0
|
@ -435,6 +435,7 @@ class InternshipApplication(models.Model):
|
||||||
resume = models.CharField(max_length=JNF_TEXT_MAX_CHARACTER_COUNT, blank=False, null=True, default=None)
|
resume = models.CharField(max_length=JNF_TEXT_MAX_CHARACTER_COUNT, blank=False, null=True, default=None)
|
||||||
additional_info = models.JSONField(blank=True, null=True, default=None)
|
additional_info = models.JSONField(blank=True, null=True, default=None)
|
||||||
selected = models.BooleanField(null=True, default=None, blank=True)
|
selected = models.BooleanField(null=True, default=None, blank=True)
|
||||||
|
offer_accepted = models.BooleanField(null=True, default=None, blank=True) # True if offer accepted, False if rejected, None if not yet decided
|
||||||
stipend = models.IntegerField(blank=True, default=None, null=True)
|
stipend = models.IntegerField(blank=True, default=None, null=True)
|
||||||
applied_at = models.DateTimeField(blank=False, default=None, null=True)
|
applied_at = models.DateTimeField(blank=False, default=None, null=True)
|
||||||
updated_at = models.DateTimeField(blank=False, default=None, null=True)
|
updated_at = models.DateTimeField(blank=False, default=None, null=True)
|
||||||
|
|
|
@ -328,17 +328,17 @@ def studentAcceptOffer(request, id, email, user_type):
|
||||||
try:
|
try:
|
||||||
company_id = request.data['id']
|
company_id = request.data['id']
|
||||||
student_id=request.data['profileInfo']['id']
|
student_id=request.data['profileInfo']['id']
|
||||||
offer_status = request.data['offerStatus']
|
offer_accepted = request.data['offerStatus']
|
||||||
if OPENING_TYPE in request.data:
|
if OPENING_TYPE in request.data:
|
||||||
opening_type = request.data[OPENING_TYPE]
|
opening_type = request.data[OPENING_TYPE]
|
||||||
else:
|
else:
|
||||||
opening_type = PLACEMENT
|
opening_type = PLACEMENT
|
||||||
if opening_type==INTERNSHIP:
|
if opening_type==INTERNSHIP:
|
||||||
application=InternshipApplication.objects.get(internship=company_id,student=student_id) #check syntax
|
application=InternshipApplication.objects.get(internship=company_id,student=student_id,selected=True)
|
||||||
else:
|
else:
|
||||||
application=PlacementApplication.objects.get(placement=company_id,student=student_id)
|
application=PlacementApplication.objects.get(placement=company_id,student=student_id,selected=True)
|
||||||
|
|
||||||
application.offer_accepted=offer_status
|
application.offer_accepted=offer_accepted
|
||||||
application.save()
|
application.save()
|
||||||
return Response({'action': "Accept Offer", 'message': "Updated Offer Status"},
|
return Response({'action': "Accept Offer", 'message': "Updated Offer Status"},
|
||||||
status=status.HTTP_200_OK)
|
status=status.HTTP_200_OK)
|
||||||
|
|
Loading…
Reference in New Issue