diff --git a/FusionIIIT/applications/examination/urls.py b/FusionIIIT/applications/examination/urls.py
index 83789d49e..caae0dc67 100644
--- a/FusionIIIT/applications/examination/urls.py
+++ b/FusionIIIT/applications/examination/urls.py
@@ -52,6 +52,12 @@
name='generate_transcript_form'),#new
# Announcement
url(r'announcement/', views.announcement, name='announcement'),#new
-
+ path('upload_grades/',views.upload_grades,name='upload_grades'),
+ path('message/',views.show_message,name='message'),
+ path('submitGradesProf/',views.submitGradesProf,name='submitGradesProf'),
+ path('download_template/',views.download_template,name='download_template'),
+ path('verifyGradesDean/',views.verifyGradesDean,name='verifyGradesDean'),
+ path('updateEntergradesDean/',views.updateEntergradesDean,name='updateEnterGradesDean'),
+ path('upload_grades_prof/',views.upload_grades_prof,name='upload_grades_prof'),
]
diff --git a/FusionIIIT/applications/examination/views.py b/FusionIIIT/applications/examination/views.py
index e65f34b3e..cc813c4c1 100644
--- a/FusionIIIT/applications/examination/views.py
+++ b/FusionIIIT/applications/examination/views.py
@@ -3,6 +3,7 @@
from django.views.generic import View
from django.http import HttpResponse
import csv
+import json
from django.db.models import IntegerField
from django.db.models.functions import Cast
from django.db.models.query_utils import Q
@@ -20,35 +21,46 @@
from django.contrib.auth.models import User
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from applications.academic_information.models import Spi, Student, Curriculum
-from applications.globals.models import (Designation, ExtraInfo,
- HoldsDesignation, Faculty)
-from applications.eis.models import (faculty_about, emp_research_projects)
+from applications.globals.models import (
+ Designation,
+ ExtraInfo,
+ HoldsDesignation,
+ Faculty,
+)
+from applications.eis.models import faculty_about, emp_research_projects
from applications.academic_information.models import Course
from applications.academic_procedures.models import course_registration, Register
from applications.programme_curriculum.filters import CourseFilter
from notification.views import examination_notif
from applications.department.models import SpecialRequest, Announcements
-from applications.globals.models import (DepartmentInfo, Designation,
- ExtraInfo, Faculty, HoldsDesignation)
+from applications.globals.models import (
+ DepartmentInfo,
+ Designation,
+ ExtraInfo,
+ Faculty,
+ HoldsDesignation,
+)
from jsonschema import validate
from jsonschema.exceptions import ValidationError
from django.shortcuts import render, redirect, HttpResponse
from rest_framework.views import APIView
from rest_framework.response import Response
from rest_framework import status
-from .models import hidden_grades
+from .models import hidden_grades, grade
from .forms import StudentGradeForm
from rest_framework.views import APIView
from rest_framework.response import Response
from rest_framework import status
from .models import hidden_grades, authentication
from rest_framework.permissions import AllowAny
-from applications.online_cms.models import (Student_grades)
-
+from applications.online_cms.models import Student_grades
+from django.http import JsonResponse
+import csv
from applications.programme_curriculum.models import Course as Courses, CourseInstructor
+from django.urls import reverse
-@login_required(login_url='/accounts/login')
+@login_required(login_url="/accounts/login")
def exam(request):
"""
This function is used to Differenciate acadadmin and all other user.
@@ -59,15 +71,21 @@ def exam(request):
@variables:
user_details - Gets the information about the logged in user.
des - Gets the designation about the looged in user.
- # """
+ #"""
user_details = ExtraInfo.objects.get(user=request.user)
- des = HoldsDesignation.objects.all().filter(user=request.user).first()
- if str(des.designation) == "Associate Professor" or str(des.designation) == "Professor" or str(des.designation) == "Assistant Professor":
- return HttpResponseRedirect('/examination/updateGrades/')
+ des = request.session.get("currentDesignationSelected")
+ if (
+ str(des) == "Associate Professor"
+ or str(des) == "Professor"
+ or str(des) == "Assistant Professor"
+ ):
+ return HttpResponseRedirect("/examination/submitGradesProf/")
elif request.session.get("currentDesignationSelected") == "acadadmin":
- return HttpResponseRedirect('/examination/updateGrades/')
+ return HttpResponseRedirect("/examination/updateGrades/")
+ elif request.session.get("currentDesignationSelected") == "Dean Academic":
+ return HttpResponseRedirect("/examination/verifyGradesDean/")
- return HttpResponseRedirect('/dashboard/')
+ return HttpResponseRedirect("/dashboard/")
@login_required(login_url='/accounts/login')
@@ -134,7 +152,7 @@ def browse_announcements():
me_ann = Announcements.objects.filter(department="ME")
sm_ann = Announcements.objects.filter(department="SM")
all_ann = Announcements.objects.filter(department="ALL")
-
+ print(cse_ann)
context = {
"cse": cse_ann,
"ece": ece_ann,
@@ -302,7 +320,7 @@ def announcement(request):
department = request.POST.get('department')
ann_date = date.today()
- obj1, created = Announcements.objects.get_or_create(
+ obj1 = Announcements.objects.get_or_create(
maker_id=user_info,
batch=batch,
programme=programme,
@@ -314,7 +332,8 @@ def announcement(request):
recipients = User.objects.all() # Modify this query as per your requirements
examination_notif(sender=usrnm, recipient=recipients, type=message)
-
+ return render(request,'department/browse_announcements_staff.html')
+ print(user_info.user_type)
context = browse_announcements()
return render(request, 'examination/announcement_req.html', {
"user_designation": user_info.user_type,
@@ -560,46 +579,53 @@ def generate_transcript_form(request):
return render(request, 'examination/generate_transcript_form.html', context)
-@login_required(login_url='/accounts/login')
+@login_required(login_url="/accounts/login")
def updateGrades(request):
- unique_course_ids = Student_grades.objects.values(
- 'course_id').distinct()
+ unique_course_ids = Student_grades.objects.values("course_id").distinct()
# Cast the course IDs to integers
unique_course_ids = unique_course_ids.annotate(
- course_id_int=Cast('course_id', IntegerField()))
+ course_id_int=Cast("course_id", IntegerField())
+ )
# Retrieve course names and course codes based on unique course IDs
- print(unique_course_ids)
+ # print(unique_course_ids)
courses_info = Courses.objects.filter(
- id__in=unique_course_ids.values_list('course_id_int', flat=True))
+ id__in=unique_course_ids.values_list("course_id_int", flat=True)
+ )
- unique_batch_ids = Student_grades.objects.values(
- 'batch').distinct()
+ unique_batch_ids = Student_grades.objects.values("batch").distinct()
context = {
- 'courses_info': courses_info,
- 'unique_batch_ids': unique_batch_ids,
+ "courses_info": courses_info,
+ "unique_batch_ids": unique_batch_ids,
}
- return render(request, '../templates/examination/submitGrade.html', context)
+ return render(request, "../templates/examination/submitGrade.html", context)
def updateEntergrades(request):
- course_id = request.GET.get('course')
- semester_id = request.GET.get('semester')
- batch = request.GET.get('batch')
-
+ course_id = request.GET.get("course")
+ semester_id = request.GET.get("semester")
+ batch = request.GET.get("batch")
course_present = Student_grades.objects.filter(
- course_id=course_id, semester=semester_id, batch=batch)
+ course_id=course_id, semester=semester_id, batch=batch
+ )
- context = {
- 'registrations': course_present
- }
+ if not course_present:
+ context = {"message": "THIS COURSE IS NOT SUBMITTED BY THE INSTRUCTOR"}
+ return render(request, "../templates/examination/message.html", context)
+
+ verification = course_present.first().verified
+ print(verification)
+ if verification:
+ context = {"message": "THIS COURSE IS VERIFIED"}
+ return render(request, "../templates/examination/message.html", context)
- return render(request, '../templates/examination/updateEntergrades.html', context)
+ context = {"registrations": course_present}
+ return render(request, "../templates/examination/updateEntergrades.html", context)
class moderate_student_grades(APIView):
permission_classes = [AllowAny]
@@ -609,6 +635,7 @@ def post(self, request):
semester_ids = request.POST.getlist('semester_ids[]')
course_ids = request.POST.getlist('course_ids[]')
grades = request.POST.getlist('grades[]')
+ allow_resubmission = request.POST.get('allow_resubmission', 'NO')
if len(student_ids) != len(semester_ids) != len(course_ids) != len(grades):
return Response({'error': 'Invalid grade data provided'}, status=status.HTTP_400_BAD_REQUEST)
@@ -619,6 +646,9 @@ def post(self, request):
grade_of_student = Student_grades.objects.get(
course_id=course_id, roll_no=student_id, semester=semester_id)
grade_of_student.grade = grade
+ grade_of_student.verified = True
+ if allow_resubmission == 'YES':
+ grade_of_student.reSubmit = True
grade_of_student.save()
except Student_grades.DoesNotExist:
# If the grade doesn't exist, create a new one
@@ -634,119 +664,493 @@ def post(self, request):
writer.writerow(['Student ID', 'Semester ID', 'Course ID', 'Grade'])
for student_id, semester_id, course_id, grade in zip(student_ids, semester_ids, course_ids, grades):
writer.writerow([student_id, semester_id, course_id, grade])
-
+ print("HELLO")
return response
return render(request, '../templates/examination/grades_updated.html', {})
-@login_required(login_url='/accounts/login')
+@login_required(login_url="/accounts/login")
def submitGrades(request):
- unique_course_ids = course_registration.objects.values(
- 'course_id').distinct()
- working_years = course_registration.objects.values(
- 'working_year').distinct()
-
-
+ unique_course_ids = course_registration.objects.values("course_id").distinct()
+ working_years = course_registration.objects.values("working_year").distinct()
# Cast the course IDs to integers
unique_course_ids = unique_course_ids.annotate(
- course_id_int=Cast('course_id', IntegerField()))
+ course_id_int=Cast("course_id", IntegerField())
+ )
# Retrieve course names and course codes based on unique course IDs
- print(unique_course_ids)
+ # print(unique_course_ids)
courses_info = Courses.objects.filter(
- id__in=unique_course_ids.values_list('course_id_int', flat=True))
+ id__in=unique_course_ids.values_list("course_id_int", flat=True)
+ )
- context = {
- 'courses_info': courses_info,
- 'working_years': working_years
- }
+ context = {"courses_info": courses_info, "working_years": working_years}
- print(working_years)
+ # print(working_years)
- return render(request, '../templates/examination/gradeSubmission.html', context)
+ return render(request, "../templates/examination/gradeSubmission.html", context)
def submitEntergrades(request):
- course_id = request.GET.get('course')
- year = request.GET.get('year')
+
+ course_id = request.GET.get("course")
+ year = request.GET.get("year")
if year is None or not year.isdigit():
message = "YEAR SHOULD NOT BE NONE"
- context = {
- 'message': message
- }
+ context = {"message": message}
- return render(request, '../templates/examination/message.html', context)
+ return render(request, "../templates/examination/message.html", context)
return HttpResponse("Invalid year parameter")
# Handle invalid year parameter
# You can return an error response or redirect the user to an error page
courses_info = Courses.objects.get(id=course_id)
- courses = Student_grades.objects.filter(
- course_id=courses_info.id, year=year)
+ courses = Student_grades.objects.filter(course_id=courses_info.id, year=year)
if courses:
message = "THIS Course was Already Submitted"
- context = {
- 'message': message
- }
+ context = {"message": message}
- return render(request, '../templates/examination/message.html', context)
+ return render(request, "../templates/examination/message.html", context)
students = course_registration.objects.filter(
- course_id_id=course_id, working_year=year)
+ course_id_id=course_id, working_year=year
+ )
# print(students)
- context = {
- 'registrations': students,
- 'curr_id': course_id,
- 'year': year
- }
+ context = {"registrations": students, "curr_id": course_id, "year": year}
- return render(request, '../templates/examination/gradeSubmissionForm.html', context)
+ return render(request, "../templates/examination/gradeSubmissionForm.html", context)
class submitEntergradesStoring(APIView):
permission_classes = [AllowAny]
def post(self, request):
- student_ids = request.POST.getlist('student_ids[]')
- batch_ids = request.POST.getlist('batch_ids[]')
- course_ids = request.POST.getlist('course_ids[]')
- semester_ids = request.POST.getlist('semester_ids[]')
- year_ids = request.POST.getlist('year_ids[]')
- marks = request.POST.getlist('marks[]')
- grades = request.POST.getlist('grades[]')
-
- if len(student_ids) != len(batch_ids) != len(course_ids) != len(semester_ids) != len(year_ids) != len(marks) != len(grades):
- return Response({'error': 'Invalid grade data provided'}, status=status.HTTP_400_BAD_REQUEST)
+ student_ids = request.POST.getlist("student_ids[]")
+ batch_ids = request.POST.getlist("batch_ids[]")
+ course_ids = request.POST.getlist("course_ids[]")
+ semester_ids = request.POST.getlist("semester_ids[]")
+ year_ids = request.POST.getlist("year_ids[]")
+ marks = request.POST.getlist("marks[]")
+ Student_grades = request.POST.getlist("Student_grades[]")
+
+ if (
+ len(student_ids)
+ != len(batch_ids)
+ != len(course_ids)
+ != len(semester_ids)
+ != len(year_ids)
+ != len(marks)
+ != len(Student_grades)
+ ):
+ return Response(
+ {"error": "Invalid Student_grades data provided"},
+ status=status.HTTP_400_BAD_REQUEST,
+ )
- for student_id, batch_id, course_id, semester_id, year_id, mark, grade in zip(student_ids, batch_ids, course_ids, semester_ids, year_ids, marks, grades):
+ for (
+ student_id,
+ batch_id,
+ course_id,
+ semester_id,
+ year_id,
+ mark,
+ Student_grades,
+ ) in zip(
+ student_ids,
+ batch_ids,
+ course_ids,
+ semester_ids,
+ year_ids,
+ marks,
+ Student_grades,
+ ):
# Create an instance of hidden_grades model and save the data
try:
grade_of_student = Student_grades.objects.get(
- course_id=course_id, roll_no=student_id, semester=semester_id)
+ course_id=course_id, roll_no=student_id, semester=semester_id
+ )
except Student_grades.DoesNotExist:
- # If the grade doesn't exist, create a new one
+ # If the Student_grades doesn't exist, create a new one
course_instance = Courses.objects.get(id=course_id)
student_grade = Student_grades.objects.create(
- course_id=course_instance, roll_no=student_id, semester=semester_id, grade=grade, batch=batch_id, year=year_id, total_marks=mark)
+ course_id=course_instance,
+ roll_no=student_id,
+ semester=semester_id,
+ Student_grades=Student_grades,
+ batch=batch_id,
+ year=year_id,
+ total_marks=mark,
+ )
student_grade.save()
- response = HttpResponse(content_type='text/csv')
- response['Content-Disposition'] = 'attachment; filename="grades.csv"'
+ response = HttpResponse(content_type="text/csv")
+ response["Content-Disposition"] = 'attachment; filename="Student_grades.csv"'
# Write data to CSV
writer = csv.writer(response)
- writer.writerow(['student_id', 'batch_ids', 'course_id',
- 'semester_id', 'year_ids', 'marks', 'grade'])
- for student_id, batch_id, course_id, semester_id, year_id, mark, grade in zip(student_ids, batch_ids, course_ids, semester_ids, year_ids, marks, grades):
- writer.writerow([student_id, batch_id, course_id,
- semester_id, year_id, mark, grade])
+ writer.writerow(
+ [
+ "student_id",
+ "batch_ids",
+ "course_id",
+ "semester_id",
+ "year_ids",
+ "marks",
+ "Student_grades",
+ ]
+ )
+ for (
+ student_id,
+ batch_id,
+ course_id,
+ semester_id,
+ year_id,
+ mark,
+ Student_grades,
+ ) in zip(
+ student_ids,
+ batch_ids,
+ course_ids,
+ semester_ids,
+ year_ids,
+ marks,
+ Student_grades,
+ ):
+ writer.writerow(
+ [
+ student_id,
+ batch_id,
+ course_id,
+ semester_id,
+ year_id,
+ mark,
+ Student_grades,
+ ]
+ )
return response
- return render(request, '../templates/examination/grades_updated.html', {})
+ return render(request, "../templates/examination/grades_updated.html", {})
+
+
+def upload_grades(request):
+ if request.method == "POST" and request.FILES.get("csv_file"):
+ csv_file = request.FILES["csv_file"]
+
+ if not csv_file.name.endswith(".csv"):
+ return JsonResponse(
+ {"error": "Invalid file format. Please upload a CSV file."}, status=400
+ )
+
+ course_id = request.POST.get("course_id")
+ academic_year = request.POST.get("academic_year")
+ # semester = request.POST.get('semester')
+
+ if academic_year == "None" or not academic_year.isdigit():
+ return JsonResponse(
+ {"error": "Academic year must be a valid number."}, status=400
+ )
+
+ if not course_id or not academic_year:
+ return JsonResponse(
+ {"error": "Course ID and Academic Year are required."}, status=400
+ )
+
+ courses_info = Courses.objects.get(id=course_id)
+
+ courses = Student_grades.objects.filter(
+ course_id=courses_info.id, year=academic_year
+ )
+ students = course_registration.objects.filter(
+ course_id_id=course_id, working_year=academic_year
+ )
+
+ if not students:
+ message = "NO STUDENTS REGISTERED IN THIS COURSE THIS SEMESTER"
+ redirect_url = reverse("examination:message") + f"?message={message}"
+ return JsonResponse(
+ {"error": message, "redirect_url": redirect_url}, status=400
+ )
+
+ if courses:
+ message = "THIS Course was Already Submitted"
+ redirect_url = reverse("examination:message") + f"?message={message}"
+ return JsonResponse(
+ {"error": message, "redirect_url": redirect_url}, status=400
+ )
+
+ semester = students.first().semester_id_id
+
+ try:
+ # Parse the CSV file
+ decoded_file = csv_file.read().decode("utf-8").splitlines()
+ reader = csv.DictReader(decoded_file)
+
+ required_columns = ["roll_no", "name", "grade", "remarks"]
+ if not all(column in reader.fieldnames for column in required_columns):
+ return JsonResponse(
+ {
+ "error": "CSV file must contain the following columns: roll_no, name, grade, remarks."
+ },
+ status=400,
+ )
+
+ for row in reader:
+ roll_no = row["roll_no"]
+ grade = row["grade"]
+ remarks = row["remarks"]
+ batch_prefix = roll_no[:2]
+ batch = int(f"20{batch_prefix}")
+
+ Student_grades.objects.create(
+ roll_no=roll_no,
+ grade=grade,
+ remarks=remarks,
+ course_id_id=course_id,
+ year=academic_year,
+ semester=semester,
+ batch=batch,
+ )
+ des = request.session.get("currentDesignationSelected")
+ if (
+ str(des) == "Associate Professor"
+ or str(des) == "Professor"
+ or str(des) == "Assistant Professor"
+ ):
+ return JsonResponse(
+ {
+ "message": "Grades uploaded successfully.",
+ "redirect_url": "/examination/submitGradesProf",
+ }
+ )
+ return JsonResponse(
+ {
+ "message": "Grades uploaded successfully.",
+ "redirect_url": "/examination/submitGrades",
+ }
+ )
+
+ except Courses.DoesNotExist:
+ return JsonResponse({"error": "Invalid course ID."}, status=400)
+
+ except Exception as e:
+ return JsonResponse({"error": f"An error occurred: {e}"}, status=500)
+
+ return JsonResponse(
+ {"error": "Invalid request. Please upload a CSV file."}, status=400
+ )
+
+
+def show_message(request):
+ message = request.GET.get("message", "Default message if none provided.")
+ des = request.session.get("currentDesignationSelected")
+ if (
+ str(des) == "Associate Professor"
+ or str(des) == "Professor"
+ or str(des) == "Assistant Professor"
+ ):
+ return render(request, "examination/messageProf.html", {"message": message})
+ return render(request, "examination/message.html", {"message": message})
+
+
+@login_required(login_url="/accounts/login")
+def submitGradesProf(request):
+ # print(request.user,1)
+ unique_course_ids = (
+ CourseInstructor.objects.filter(instructor_id_id=request.user.username)
+ .values("course_id_id")
+ .distinct()
+ )
+ # unique_course_ids = course_registration.objects.values(
+ # 'course_id').distinct()
+ working_years = course_registration.objects.values("working_year").distinct()
+
+ # Cast the course IDs to integers
+ unique_course_ids = unique_course_ids.annotate(
+ course_id_int=Cast("course_id", IntegerField())
+ )
+
+ # Retrieve course names and course codes based on unique course IDs
+
+ print(unique_course_ids)
+ courses_info = Courses.objects.filter(
+ id__in=unique_course_ids.values_list("course_id_int", flat=True)
+ )
+
+ context = {"courses_info": courses_info, "working_years": working_years}
+
+ print(working_years)
+
+ return render(request, "../templates/examination/submitGradesProf.html", context)
+
+
+def download_template(request):
+ response = HttpResponse(content_type="text/csv")
+ response["Content-Disposition"] = f'attachment; filename="template.csv"'
+ writer = csv.writer(response)
+ writer.writerow(["roll_no", "name", "grade", "remarks"])
+
+ return response
+
+
+
+def verifyGradesDean(request):
+ unique_course_ids = Student_grades.objects.filter(verified=True).values("course_id").distinct()
+
+ # Cast the course IDs to integers
+ unique_course_ids = unique_course_ids.annotate(
+ course_id_int=Cast("course_id", IntegerField())
+ )
+
+ # Retrieve course names and course codes based on unique course IDs
+
+ # print(unique_course_ids)
+ courses_info = Courses.objects.filter(
+ id__in=unique_course_ids.values_list("course_id_int", flat=True)
+ )
+
+ unique_batch_ids = Student_grades.objects.values("batch").distinct()
+
+ context = {
+ "courses_info": courses_info,
+ "unique_batch_ids": unique_batch_ids,
+ }
+
+ return render(request, "../templates/examination/submitGradeDean.html", context)
+
+
+def updateEntergradesDean(request):
+ course_id = request.GET.get("course")
+ semester_id = request.GET.get("semester")
+ batch = request.GET.get("batch")
+ course_present = Student_grades.objects.filter(
+ course_id=course_id, semester=semester_id, batch=batch
+ )
+
+ if not course_present:
+ context = {"message": "THIS COURSE IS NOT SUBMITTED BY THE INSTRUCTOR"}
+ return render(request, "../templates/examination/message.html", context)
+
+ context = {"registrations": course_present}
+
+ return render(request, "../templates/examination/updateEntergradesDean.html", context)
+
+
+
+def upload_grades_prof(request):
+ if request.method == "POST" and request.FILES.get("csv_file"):
+ csv_file = request.FILES["csv_file"]
+
+ if not csv_file.name.endswith(".csv"):
+ return JsonResponse(
+ {"error": "Invalid file format. Please upload a CSV file."}, status=400
+ )
+
+ course_id = request.POST.get("course_id")
+ academic_year = request.POST.get("academic_year")
+ # semester = request.POST.get('semester')
+
+ if academic_year == "None" or not academic_year.isdigit():
+ return JsonResponse(
+ {"error": "Academic year must be a valid number."}, status=400
+ )
+
+ if not course_id or not academic_year:
+ return JsonResponse(
+ {"error": "Course ID and Academic Year are required."}, status=400
+ )
+
+ courses_info = Courses.objects.get(id=course_id)
+
+ courses = Student_grades.objects.filter(
+ course_id=courses_info.id, year=academic_year
+ )
+ students = course_registration.objects.filter(
+ course_id_id=course_id, working_year=academic_year
+ )
+
+ if not students:
+ message = "NO STUDENTS REGISTERED IN THIS COURSE THIS SEMESTER"
+ redirect_url = reverse("examination:message") + f"?message={message}"
+ return JsonResponse(
+ {"error": message, "redirect_url": redirect_url}, status=400
+ )
+ print(courses.first().reSubmit)
+ 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
+ )
+
+ semester = students.first().semester_id_id
+
+ try:
+ # Parse the CSV file
+ decoded_file = csv_file.read().decode("utf-8").splitlines()
+ reader = csv.DictReader(decoded_file)
+
+ required_columns = ["roll_no", "name", "grade", "remarks"]
+ if not all(column in reader.fieldnames for column in required_columns):
+ return JsonResponse(
+ {
+ "error": "CSV file must contain the following columns: roll_no, name, grade, remarks."
+ },
+ status=400,
+ )
+
+ for row in reader:
+ roll_no = row["roll_no"]
+ grade = row["grade"]
+ remarks = row["remarks"]
+ batch_prefix = roll_no[:2]
+ batch = int(f"20{batch_prefix}")
+ reSubmit=False
+ Student_grades.objects.update_or_create(
+ roll_no=roll_no,
+ course_id_id=course_id,
+ year=academic_year,
+ semester=semester,
+ # Fields that will be updated if a match is found
+ defaults={
+ 'grade': grade,
+ 'remarks': remarks,
+ 'reSubmit': reSubmit,
+ }
+ )
+ des = request.session.get("currentDesignationSelected")
+ if (
+ str(des) == "Associate Professor"
+ or str(des) == "Professor"
+ or str(des) == "Assistant Professor"
+ ):
+ return JsonResponse(
+ {
+ "message": "Grades uploaded successfully.",
+ "redirect_url": "/examination/submitGradesProf",
+ }
+ )
+ return JsonResponse(
+ {
+ "message": "Grades uploaded successfully.",
+ "redirect_url": "/examination/submitGrades",
+ }
+ )
+
+ except Courses.DoesNotExist:
+ return JsonResponse({"error": "Invalid course ID."}, status=400)
+
+ except Exception as e:
+ return JsonResponse({"error": f"An error occurred: {e}"}, status=500)
+
+ return JsonResponse(
+ {"error": "Invalid request. Please upload a CSV file."}, status=400
+ )
+
diff --git a/FusionIIIT/applications/online_cms/migrations/0002_auto_20241021_0331.py b/FusionIIIT/applications/online_cms/migrations/0002_auto_20241021_0331.py
new file mode 100644
index 000000000..0a441f642
--- /dev/null
+++ b/FusionIIIT/applications/online_cms/migrations/0002_auto_20241021_0331.py
@@ -0,0 +1,37 @@
+# Generated by Django 3.1.5 on 2024-10-21 03:31
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('online_cms', '0001_initial'),
+ ]
+
+ operations = [
+ migrations.RemoveField(
+ model_name='student_grades',
+ name='total_marks',
+ ),
+ migrations.AddField(
+ model_name='student_grades',
+ name='remarks',
+ field=models.CharField(max_length=500, null=True),
+ ),
+ migrations.AddField(
+ model_name='student_grades',
+ name='verified',
+ field=models.BooleanField(default=False),
+ ),
+ migrations.AlterField(
+ model_name='attendance',
+ name='present',
+ field=models.IntegerField(default=0),
+ ),
+ migrations.AlterField(
+ model_name='gradingscheme',
+ name='type_of_evaluation',
+ field=models.CharField(max_length=100),
+ ),
+ ]
diff --git a/FusionIIIT/applications/online_cms/models.py b/FusionIIIT/applications/online_cms/models.py
index 3a63aca08..98d68b24c 100644
--- a/FusionIIIT/applications/online_cms/models.py
+++ b/FusionIIIT/applications/online_cms/models.py
@@ -267,10 +267,11 @@ class Student_grades(models.Model):
semester = models.IntegerField(default=1)
year = models.IntegerField(default=2016)
roll_no = models.TextField(max_length=2000)
- total_marks = models.DecimalField(max_digits=10, decimal_places=2, default=0)
grade = models.TextField(max_length=2000)
batch = models.IntegerField(default=2021)
-
+ remarks = models.CharField(max_length=500,null=True)
+ verified = models.BooleanField(default=False)
+ reSubmit = models.BooleanField(default=True)
def __str__(self):
return '{} - {}'.format(self.pk, self.course_id)
diff --git a/FusionIIIT/templates/examination/announcement_req.html b/FusionIIIT/templates/examination/announcement_req.html
index 99bb51e9c..d8482bf62 100644
--- a/FusionIIIT/templates/examination/announcement_req.html
+++ b/FusionIIIT/templates/examination/announcement_req.html
@@ -42,9 +42,9 @@
Verify
- Authenticate Course
+ {% comment %} Authenticate Course
-
+ {% endcomment %}
diff --git a/FusionIIIT/templates/examination/generate_transcript.html b/FusionIIIT/templates/examination/generate_transcript.html
index 6b1cf4a9e..58e012b06 100644
--- a/FusionIIIT/templates/examination/generate_transcript.html
+++ b/FusionIIIT/templates/examination/generate_transcript.html
@@ -54,9 +54,9 @@
Verify
- Authenticate Course
+ {% comment %} Authenticate Course
-
+ {% endcomment %}
Announcement
diff --git a/FusionIIIT/templates/examination/generate_transcript_form.html b/FusionIIIT/templates/examination/generate_transcript_form.html
index e0bd04fae..229bd9331 100644
--- a/FusionIIIT/templates/examination/generate_transcript_form.html
+++ b/FusionIIIT/templates/examination/generate_transcript_form.html
@@ -8,9 +8,9 @@
Verify
- Authenticate Course
+ {% comment %} Authenticate Course
-
+ {% endcomment %}
Announcement
diff --git a/FusionIIIT/templates/examination/generate_transcript_students.html b/FusionIIIT/templates/examination/generate_transcript_students.html
index 6bc1edd66..f7beb443c 100644
--- a/FusionIIIT/templates/examination/generate_transcript_students.html
+++ b/FusionIIIT/templates/examination/generate_transcript_students.html
@@ -42,9 +42,9 @@
Verify
- Authenticate Course
+ {% comment %} Authenticate Course
-
+ {% endcomment %}
Announcement
diff --git a/FusionIIIT/templates/examination/gradeSubmission.html b/FusionIIIT/templates/examination/gradeSubmission.html
index c79b41b7f..ac46c59c7 100644
--- a/FusionIIIT/templates/examination/gradeSubmission.html
+++ b/FusionIIIT/templates/examination/gradeSubmission.html
@@ -2,17 +2,15 @@
{% block sidetabmenu %}
Submit Results
SUBMIT STUDENT MARKS
window.location.href = "{% url 'examination:updateGrades' %}";
}
-{% endblock %}
\ No newline at end of file
+{% endblock %}
\ No newline at end of file
diff --git a/FusionIIIT/templates/examination/message.html b/FusionIIIT/templates/examination/message.html
index 73ca5caa4..6df482710 100644
--- a/FusionIIIT/templates/examination/message.html
+++ b/FusionIIIT/templates/examination/message.html
@@ -42,9 +42,9 @@
Verify
- Authenticate Course
+ {% comment %} Authenticate Course
-
+ {% endcomment %}
Announcement
diff --git a/FusionIIIT/templates/examination/messageProf.html b/FusionIIIT/templates/examination/messageProf.html
new file mode 100644
index 000000000..f63749792
--- /dev/null
+++ b/FusionIIIT/templates/examination/messageProf.html
@@ -0,0 +1,70 @@
+{% extends 'examination/base.html' %}
+
+{% block sidetabmenu %}
+
+Update Result
+
+
+Submit Results
+
+
+VERIFY STUDENT MARKS
+{% endblock %}
+
+{% block content %}
+