r/learnprogramming • • 9d ago

Solved The attandance System problem

Me & my friend are chosen for making attendance system for our college

We have one issue like

If a Students name called "X" is in section A he attend maths 10 class of 30 & now he change Section To B there we have only 20 class of but he already attended 10 class there & we don't now how much he skip there like out of 20 he join at 10th class & make 2 present next than in those sections he have low attendance & after changing he gain more attandance ....

... Idk you understand this problem or not we just have attandance calculation issue in data base or back-end cause how to calculate those data or compare .... The rule is student not losse or gain his attendance my probablity okey

Please help 😭

0 Upvotes

5 comments sorted by

1

u/Mell-Silver-20 8d ago

I think the best way is to track attendance based on individual class sessions rather than section-wise percentages. Keep the student's attendance history unchanged when they switch sections, and calculate the percentage using only the classes they were actually expected to attend. That way, changing sections won't unfairly increase or decrease their attendance.

1

u/GoHarder_MoveFaster 8d ago

You need to store attendance records tied to specific course sessions or dates rather than just a flat percentage, so when a student switches sections you can recalculate their total attended classes divided by total classes held in the sections they were actually enrolled in on those specific dates.

1

u/ChillyFireball 8d ago

I read through this a couple times trying to understand the question, and it sounds like you want to be able to track attendance across different sections of the same class? It's hard to say without seeing how your data looks, but I'm assuming the class has some kind of class ID separate from the section ID, in which case you should track those separately. ex.

class Student {     string firstname;     string lastname;     string studentId; // To handle duplicate names     Map<string, ClassAttendance> classes; }

class ClassAttendance {     string classId;     string sectionId;     int attendedClasses; }

class ClassDetail {     string classId;     Map<string, SectionDetail> sections; }

class SectionDetail {     string sectionId;     int classCount; }

Then you can freely change the student's section, and at the end  when you need the attendance percentage, it's student.classes[classId].attendedClasses / allClassDetails.sections[student.classes[classId].sectionId].classCount * 100

If you're storing it in a database, you can have tables for classes, sections, and students, and join them on ID when querying. (ex. Select all rows where class ID matches and section ID matches from the student and section tables. I won't give you any actual syntax examples because my SQL is incredibly rusty.)

1

u/Available_Safe1818 7d ago

Can you just count the number of classes attended? What is the problem here?