Skip to content

Commit

Permalink
allowed resubmission for acadadmin
Browse files Browse the repository at this point in the history
  • Loading branch information
Lone24wolf committed Jan 20, 2025
1 parent 605aaa1 commit e309dc8
Showing 1 changed file with 19 additions and 11 deletions.
30 changes: 19 additions & 11 deletions FusionIIIT/applications/examination/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -962,13 +962,16 @@ def upload_grades(request):
{"error": message, "redirect_url": redirect_url}, status=400
)

if courses:
if courses and not courses.first().reSubmit:

message = "THIS Course was Already Submitted"
redirect_url = reverse("examination:message") + f"?message={message}"
return JsonResponse(
{"error": message, "redirect_url": redirect_url}, status=400
)



try:
# Parse the CSV file
decoded_file = csv_file.read().decode("utf-8").splitlines()
Expand All @@ -991,15 +994,20 @@ def upload_grades(request):
stud = Student.objects.get(id_id=roll_no)
semester = semester or stud.curr_semester_no
batch=stud.batch

Student_grades.objects.create(
roll_no=roll_no,
grade=grade,
remarks=remarks,
course_id_id=course_id,
year=academic_year,
semester=semester,
batch=batch,
reSubmit=False

Student_grades.objects.update_or_create(
roll_no=roll_no,
course_id_id=course_id,
year=academic_year,
semester=semester,
batch=batch,
# Fields that will be updated if a match is found
defaults={
'grade': grade,
'remarks': remarks,
'reSubmit': reSubmit,
}
)
des = request.session.get("currentDesignationSelected")
if (
Expand Down Expand Up @@ -1309,7 +1317,7 @@ def upload_grades_prof(request):
return JsonResponse(
{
"message": "Grades uploaded successfully.",
"redirect_url": "/examination/submitGrades",
"redirect_url": "/examination/submitGradesProf",
}
)

Expand Down

0 comments on commit e309dc8

Please sign in to comment.