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

Ac 7 examination #1671

Merged
merged 3 commits into from
Dec 4, 2024
Merged
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
9 changes: 6 additions & 3 deletions FusionIIIT/applications/examination/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1522,8 +1522,11 @@ def generate_pdf(request):
academic_year = request.POST.get('academic_year')
course_info = get_object_or_404(Courses, id=course_id)
grades = Student_grades.objects.filter(course_id_id=course_id, year=academic_year).order_by("roll_no")

# Calculate grade counts
course=CourseInstructor.objects.get(course_id_id=course_id,year=academic_year)
if not course:
return JsonResponse({"success": False, "error": "course not found."}, status=404)
semester=course.semester_no

all_grades = ["O", "A+", "A", "B+", "B", "C+", "C", "D+", "D", "F", "I", "S", "X"]
grade_counts = {grade: grades.filter(grade=grade).count() for grade in all_grades}

Expand Down Expand Up @@ -1572,7 +1575,7 @@ def generate_pdf(request):

# Add fields with labels in black and values in gray
elements.append(Paragraph(f"<b>Session:</b> {academic_year}", field_label_style))
elements.append(Paragraph(f"<b>Semester:</b> {grades.first().semester}", field_label_style))
elements.append(Paragraph(f"<b>Semester:</b> {semester}", field_label_style))
elements.append(Paragraph(f"<b>Course Code:</b> {course_info.code}", field_label_style))
elements.append(Paragraph(f"<b>Course Name:</b> {course_info.name}", field_label_style))
elements.append(Paragraph(f"<b>Instructor:</b> {instructor}", field_label_style))
Expand Down
Loading