Add disinclude option for assignments from other classes
This commit is contained in:
parent
5577214005
commit
8acc77e441
8 changed files with 230 additions and 17 deletions
|
|
@ -77,14 +77,18 @@ export class LocalDatabase {
|
|||
for (const item of newAssignments) {
|
||||
const existing = student.assignments[item.id];
|
||||
if (existing) {
|
||||
// Preserve user completion status and completion timestamp
|
||||
// Preserve user completion status, timestamp, and disincluded flag
|
||||
student.assignments[item.id] = {
|
||||
...item,
|
||||
completed: existing.completed,
|
||||
completedAt: existing.completedAt
|
||||
completedAt: existing.completedAt,
|
||||
excluded: existing.excluded || false
|
||||
};
|
||||
} else {
|
||||
student.assignments[item.id] = item;
|
||||
student.assignments[item.id] = {
|
||||
...item,
|
||||
excluded: false
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -92,6 +96,20 @@ export class LocalDatabase {
|
|||
return student;
|
||||
}
|
||||
|
||||
public toggleExcludeAssignment(studentId: string, assignmentId: string, excluded?: boolean): Assignment | null {
|
||||
const student = this.getStudentStore(studentId);
|
||||
const assignment = student.assignments[assignmentId];
|
||||
if (!assignment) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const newExcluded = excluded !== undefined ? excluded : !assignment.excluded;
|
||||
assignment.excluded = newExcluded;
|
||||
|
||||
this.save();
|
||||
return assignment;
|
||||
}
|
||||
|
||||
public toggleAssignment(studentId: string, assignmentId: string, completed?: boolean): Assignment | null {
|
||||
const student = this.getStudentStore(studentId);
|
||||
const assignment = student.assignments[assignmentId];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue