I am in the database design phase of my MERN app (I use Next.js instead of just React.js). My app is basically an LMS (learning management system where professors can put assignments, tests, resources, etc etc. Students can access those, do it and submit them. I am trying to think about how do I go about the Gradebook. Every student will have a grade in all of the classes they are in. I am using MongoDB. How do I design the gradebook? I can't just put a 'grade' or 'marks' field in the Course database because all students in that class for that assignment will have different grades. Please help. If you were to design an LMS, how would you set up the "Grades" to work?
CodePudding user response:
Data structure:
db={
"students": [
{
"_id": "1",
"class_id": "5",
"name": "Sam"
},
{
"_id": "2",
"class_id": "5",
"name": "Tom"
}
],
"classes": [
{
"_id": "5",
"grade": 6,
"room": "A-2"
}
],
"teachers": [
{
"_id": "1",
"name": "John"
},
{
"_id": "2",
"name": "kyle"
}
],
"items": [
{
"_id": "1",
"learning_type": "MATH",
"item_type": "TEST",
"teacher_id": "1"
},
{
"_id": "2",
"learning_type": "HISTORY",
"item_type": "ASSIGNMENT",
"teacher_id": "1"
},
{
"_id": "3",
"learning_type": "ENGLISH",
"item_type": "RESOURCE",
"teacher_id": "2"
}
],
"gradebook": [
{
"_id": "1",
"test_id": "2",
"student_id": "1",
"item_id": "1",
"score": 80,
"isChecked": true
},
{
"_id": "2",
"test_id": "2",
"student_id": "2",
"item_id": "1",
"score": 0,
"isChecked": false
}
]
}
If you want to ask how to use this data structure to query specific data, please give the query parameters and expected output, I will add the query function.