Compare commits
17 Commits
48451b9060
...
1b1543d2af
Author | SHA1 | Date |
---|---|---|
Challenger | 1b1543d2af | |
Jaya Surya P | 90f028651d | |
NitinVangipuram | 3d42366e50 | |
NitinVangipuram | 95d7689a4c | |
Jaya Surya P | 642ad8e326 | |
NitinVangipuram | 8aa7246ec9 | |
Jaya Surya P | e184d2af53 | |
NitinVangipuram | e717cbc6e6 | |
NitinVangipuram | e242fff9a7 | |
Jaya Surya P | 4c248be3a5 | |
Jaya Surya P | 7eee78177c | |
NitinVangipuram | ce97fc8342 | |
Challenger | f0a02ec2d0 | |
Challenger | 35391e6173 | |
Challenger | 1da13d787f | |
Challenger | 70711888ea | |
Challenger | 609eb1a159 |
|
@ -310,13 +310,17 @@ def submitApplication(request, id, email, user_type):
|
||||||
try:
|
try:
|
||||||
data = request.data
|
data = request.data
|
||||||
if OPENING_TYPE in data:
|
if OPENING_TYPE in data:
|
||||||
opening_type= data[OPENING_TYPE]
|
if data[OPENING_TYPE] == "Internship":
|
||||||
|
opening_type= "Internship"
|
||||||
|
elif data[OPENING_TYPE] == "placements":
|
||||||
|
opening_type= "Placement"
|
||||||
else:
|
else:
|
||||||
opening_type= "Placement"
|
opening_type= "Placement"
|
||||||
if opening_type == "Internship":
|
if opening_type == "Internship":
|
||||||
opening = get_object_or_404(Internship, pk=data[OPENING_ID])
|
opening = get_object_or_404(Internship, pk=data[OPENING_ID])
|
||||||
else:
|
else:
|
||||||
opening = get_object_or_404(Placement, pk=data[OPENING_ID])
|
opening = get_object_or_404(Placement, pk=data[OPENING_ID])
|
||||||
|
# print(opening);
|
||||||
student = get_object_or_404(Student, pk=data[STUDENT_ID])
|
student = get_object_or_404(Student, pk=data[STUDENT_ID])
|
||||||
# opening = get_object_or_404(Placement, pk=data[OPENING_ID])
|
# opening = get_object_or_404(Placement, pk=data[OPENING_ID])
|
||||||
student_user = get_object_or_404(User, id=student.id)
|
student_user = get_object_or_404(User, id=student.id)
|
||||||
|
@ -446,8 +450,7 @@ def generateCSV(request, id, email, user_type):
|
||||||
row_details.append(apl.selected)
|
row_details.append(apl.selected)
|
||||||
|
|
||||||
for i in opening.additional_info:
|
for i in opening.additional_info:
|
||||||
row_details.append(json.loads(apl.additional_info)[i])
|
row_details.append(json.loads(apl.additional_info).get(i, ''))
|
||||||
|
|
||||||
writer.writerow(row_details)
|
writer.writerow(row_details)
|
||||||
f.close()
|
f.close()
|
||||||
file_path = LINK_TO_APPLICATIONS_CSV + urllib.parse.quote_plus(filename + ".csv")
|
file_path = LINK_TO_APPLICATIONS_CSV + urllib.parse.quote_plus(filename + ".csv")
|
||||||
|
@ -623,6 +626,17 @@ def getStats(request, id, email, user_type):
|
||||||
"psu":0,
|
"psu":0,
|
||||||
|
|
||||||
},
|
},
|
||||||
|
"EP":{
|
||||||
|
"1":0,
|
||||||
|
"2":0,
|
||||||
|
"3":0,
|
||||||
|
"4":0,
|
||||||
|
"5":0,
|
||||||
|
"6":0,
|
||||||
|
"7":0,
|
||||||
|
"8":0,
|
||||||
|
"psu":0,
|
||||||
|
},
|
||||||
"Total": {
|
"Total": {
|
||||||
"1":0,
|
"1":0,
|
||||||
"2":0,
|
"2":0,
|
||||||
|
@ -639,6 +653,7 @@ def getStats(request, id, email, user_type):
|
||||||
"CSE": 0,
|
"CSE": 0,
|
||||||
"EE": 0,
|
"EE": 0,
|
||||||
"MMAE": 0,
|
"MMAE": 0,
|
||||||
|
"EP": 0,
|
||||||
"Total": 0,
|
"Total": 0,
|
||||||
}
|
}
|
||||||
number_of_students_with_multiple_offers = 0
|
number_of_students_with_multiple_offers = 0
|
||||||
|
@ -646,22 +661,26 @@ def getStats(request, id, email, user_type):
|
||||||
"CSE": 0,
|
"CSE": 0,
|
||||||
"EE": 0,
|
"EE": 0,
|
||||||
"MMAE": 0,
|
"MMAE": 0,
|
||||||
|
"EP": 0,
|
||||||
"Total": 0,
|
"Total": 0,
|
||||||
}
|
}
|
||||||
max_CTC = {
|
max_CTC = {
|
||||||
"CSE": 0,
|
"CSE": 0,
|
||||||
"EE": 0,
|
"EE": 0,
|
||||||
"MMAE": 0
|
"MMAE": 0,
|
||||||
|
"EP": 0,
|
||||||
}
|
}
|
||||||
average_CTC = {
|
average_CTC = {
|
||||||
"CSE": 0,
|
"CSE": 0,
|
||||||
"EE": 0,
|
"EE": 0,
|
||||||
"MMAE": 0
|
"MMAE": 0,
|
||||||
|
"EP": 0,
|
||||||
}
|
}
|
||||||
count = {
|
count = {
|
||||||
"CSE": 0,
|
"CSE": 0,
|
||||||
"EE": 0,
|
"EE": 0,
|
||||||
"MMAE": 0
|
"MMAE": 0,
|
||||||
|
"EP": 0,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -116,7 +116,6 @@ def getDashboard(request, id, email, user_type):
|
||||||
|
|
||||||
placements = Placement.objects.filter(filters).order_by('deadline_datetime')
|
placements = Placement.objects.filter(filters).order_by('deadline_datetime')
|
||||||
filtered_placements = placement_eligibility_filters(studentDetails, placements)
|
filtered_placements = placement_eligibility_filters(studentDetails, placements)
|
||||||
|
|
||||||
placementsdata = PlacementSerializerForStudent(filtered_placements, many=True).data
|
placementsdata = PlacementSerializerForStudent(filtered_placements, many=True).data
|
||||||
|
|
||||||
placementApplications = PlacementApplication.objects.filter(student_id=id).order_by('-updated_at')
|
placementApplications = PlacementApplication.objects.filter(student_id=id).order_by('-updated_at')
|
||||||
|
@ -129,13 +128,7 @@ def getDashboard(request, id, email, user_type):
|
||||||
email_verified=True
|
email_verified=True
|
||||||
).order_by('deadline_datetime')
|
).order_by('deadline_datetime')
|
||||||
else:
|
else:
|
||||||
internships = Internship.objects.filter(
|
internships = Internship.objects.filter(filters).order_by('deadline_datetime')
|
||||||
allowed_batch__contains=[studentDetails.batch],
|
|
||||||
allowed_branch__contains=[studentDetails.branch],
|
|
||||||
deadline_datetime__gte=datetime.datetime.now(),
|
|
||||||
offer_accepted=True,
|
|
||||||
email_verified=True
|
|
||||||
).order_by('deadline_datetime')
|
|
||||||
|
|
||||||
|
|
||||||
filtered_internships = internship_eligibility_filters(studentDetails, internships)
|
filtered_internships = internship_eligibility_filters(studentDetails, internships)
|
||||||
|
@ -207,11 +200,14 @@ def submitApplication(request, id, email, user_type):
|
||||||
if not len(PlacementApplication.objects.filter(
|
if not len(PlacementApplication.objects.filter(
|
||||||
student_id=id, placement_id=data[OPENING_ID])):
|
student_id=id, placement_id=data[OPENING_ID])):
|
||||||
application = PlacementApplication()
|
application = PlacementApplication()
|
||||||
opening = get_object_or_404(Placement, id=data[OPENING_ID],
|
application_filters = Q(
|
||||||
allowed_batch__contains=[student.batch],
|
id=data[OPENING_ID],
|
||||||
allowed_branch__contains=[student.branch],
|
allowed_branch__contains=[student.branch],
|
||||||
deadline_datetime__gte=timezone.now()
|
deadline_datetime__gte=timezone.now()
|
||||||
)
|
)
|
||||||
|
if student.degree == "Btech":
|
||||||
|
application_filters &= Q(allowed_batch__contains=[student.batch])
|
||||||
|
opening = get_object_or_404(Placement.objects.filter(application_filters))
|
||||||
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")
|
||||||
|
|
||||||
|
@ -228,11 +224,14 @@ def submitApplication(request, id, email, user_type):
|
||||||
if not len(InternshipApplication.objects.filter(
|
if not len(InternshipApplication.objects.filter(
|
||||||
student_id=id, internship_id=data[OPENING_ID])):
|
student_id=id, internship_id=data[OPENING_ID])):
|
||||||
application = InternshipApplication()
|
application = InternshipApplication()
|
||||||
opening = get_object_or_404(Internship, id=data[OPENING_ID],
|
application_filters = Q(
|
||||||
allowed_batch__contains=[student.batch],
|
id=data[OPENING_ID],
|
||||||
allowed_branch__contains=[student.branch],
|
allowed_branch__contains=[student.branch],
|
||||||
deadline_datetime__gte=timezone.now()
|
deadline_datetime__gte=timezone.now()
|
||||||
)
|
)
|
||||||
|
if student.degree == "Btech":
|
||||||
|
application_filters &= Q(allowed_batch__contains=[student.batch])
|
||||||
|
opening = get_object_or_404(Internship.objects.filter(application_filters))
|
||||||
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")
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,70 @@
|
||||||
|
import random
|
||||||
|
from django.db.utils import IntegrityError
|
||||||
|
from APIs.models import Student
|
||||||
|
|
||||||
|
from APIs.constants import BRANCHES, BATCH_CHOICES, DEGREE_CHOICES
|
||||||
|
|
||||||
|
# To run this script run the following command:
|
||||||
|
# python manage.py runscript add_students --script-args <add_type> <num_of_stundents_to_add>
|
||||||
|
|
||||||
|
|
||||||
|
def run(*args):
|
||||||
|
|
||||||
|
# Throw error if invalid number of arguments passed
|
||||||
|
if not args:
|
||||||
|
raise ValueError("Invalid number of arguments passed")
|
||||||
|
|
||||||
|
if args[0] in ("manual", "man") :
|
||||||
|
|
||||||
|
if len(args) != 2 or not args[1].isdigit() or int(args[1]) < 1:
|
||||||
|
raise ValueError("Invalid number of arguments passed")
|
||||||
|
|
||||||
|
print("id\troll_no\tname\tbranch\tphone_number\tcpi\tdegree\tbatch")
|
||||||
|
for i in range(1, int(args[1])+1):
|
||||||
|
details = input()
|
||||||
|
details = details.split(",")
|
||||||
|
details = [i.strip() for i in details]
|
||||||
|
details = [int(details[0]), int(details[1]), details[2], details[3],
|
||||||
|
int(details[4]), float(details[5]), details[6], details[7]]
|
||||||
|
|
||||||
|
student = Student.objects.create(
|
||||||
|
id = details[0],
|
||||||
|
roll_no = details[1],
|
||||||
|
name = details[2],
|
||||||
|
branch = details[3],
|
||||||
|
phone_number = details[4],
|
||||||
|
cpi = details[5],
|
||||||
|
degree = details[6],
|
||||||
|
batch = details[7],
|
||||||
|
|
||||||
|
)
|
||||||
|
student.save()
|
||||||
|
|
||||||
|
elif args[0] in ("auto", "automatic"):
|
||||||
|
if len(args) != 2 or not args[1].isdigit() or int(args[1]) < 1:
|
||||||
|
raise ValueError("Invalid number of arguments passed")
|
||||||
|
|
||||||
|
for i in range(1, int(args[1])+1):
|
||||||
|
try:
|
||||||
|
student = Student.objects.create(
|
||||||
|
id = i-1,
|
||||||
|
roll_no = 220010000 + i,
|
||||||
|
name = "Student " + str(i),
|
||||||
|
branch = random.choice(BRANCHES),
|
||||||
|
phone_number = random.randint(1000000000, 9999999999),
|
||||||
|
cpi = random.random()*10,
|
||||||
|
degree = random.choice(DEGREE_CHOICES)[0],
|
||||||
|
batch = random.choice(BATCH_CHOICES)[0],
|
||||||
|
)
|
||||||
|
student.save()
|
||||||
|
except IntegrityError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
elif args[0] in ("del", "delete"):
|
||||||
|
# delete students with name starting with Student
|
||||||
|
s = Student.objects.filter(name__startswith="Stundent")
|
||||||
|
s.delete()
|
||||||
|
|
||||||
|
else:
|
||||||
|
raise ValueError("Invalid argument passed")
|
||||||
|
|
Loading…
Reference in New Issue