Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Offer status #162

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -141,3 +141,9 @@ dmypy.json
*.pyc
dev.env
.vscode/settings.json

#vscode settings
.vscode/

#vscode settings
.vscode/
2 changes: 1 addition & 1 deletion CDC_Backend/APIs/companyViews.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ def addPlacement(request):
'%d-%m-%Y').date()

# Only Allowing Fourth Year for Placement
opening.allowed_batch = [2017, 2018, 2019, 2020, 2021]
opening.allowed_batch = [FOURTH_YEAR,]
# Check if allowed_branch are valid
if data[ALLOWED_BRANCH] is None:
raise ValueError('Allowed Branch cannot be empty')
Expand Down
2 changes: 1 addition & 1 deletion CDC_Backend/APIs/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
COMPANY = 'company'
TIER = 'tier'
# To be Configured Properly
FOURTH_YEAR = '2019'
FOURTH_YEAR = '2020'
MAX_OFFERS_PER_STUDENT = 2
MAX_RESUMES_PER_STUDENT = 3
EMAIL_VERIFICATION_TOKEN_TTL = 48 # in hours
Expand Down
1 change: 1 addition & 0 deletions CDC_Backend/APIs/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ class PlacementApplication(models.Model):
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)
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
applied_at = models.DateTimeField(blank=False, default=None, null=True)
updated_at = models.DateTimeField(blank=False, default=None, null=True)
changed_by = models.ForeignKey(User, blank=False, on_delete=models.RESTRICT, default=None, null=True)
Expand Down
1 change: 1 addition & 0 deletions CDC_Backend/APIs/studentUrls.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@
path("submitApplication/", studentViews.submitApplication, name="Submit Application"),
path("deleteApplication/", studentViews.deleteApplication, name="Delete Application"),
path("getContributorStats/", studentViews.getContributorStats, name="Get Contributor Stats"),
path("studentAcceptOffer/", studentViews.studentAcceptOffer, name="Student Accept Offer"),
]
19 changes: 19 additions & 0 deletions CDC_Backend/APIs/studentViews.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,4 +273,23 @@ def getContributorStats(request, id, email, user_type):
logger.warning("Get Contributor Stats: " + str(sys.exc_info()))

return Response({'action': "Get Contributor Stats", 'message': "Something Went Wrong"},
status=status.HTTP_400_BAD_REQUEST)

#view for sudentAcceptOffer
@api_view(['POST'])
@isAuthorized(allowed_users=[STUDENT])
def studentAcceptOffer(request, id, email, user_type):
try:
company_id = request.data['id']
student_id=request.data['profileInfo']['id']
offer_status = request.data['offerStatus']
placement_application=PlacementApplication.objects.get(placement=company_id,student=student_id)
placement_application.offer_accepted=offer_status
placement_application.save()
return Response({'action': "Accept Offer", 'message': "Updated Offer Status"},
status=status.HTTP_200_OK)
except:
logger.warning("Accept Offer: " + str(sys.exc_info()))

return Response({'action': "Accept Offer", 'message': "Something Went Wrong"},
status=status.HTTP_400_BAD_REQUEST)