Allow taking attendance if not taken before

This commit is contained in:
Rotimi Best
2021-11-13 21:29:26 +02:00
parent aef491da32
commit a1f6c5728b
3 changed files with 11 additions and 6 deletions
+7 -2
View File
@@ -62,6 +62,9 @@
? $attendance[student.id][lesson.id] || {}
: {};
/*
This validation is useless. We shouldn't assume we already have an attendance item id
because it might be a new attendance.
if (!attendanceItem.id) {
$snackbarStore.open = true;
$snackbarStore.severity = SNACKBAR_SEVERITY.ERROR;
@@ -71,6 +74,7 @@
return;
}
*/
const data = {
id: attendanceItem.id,
@@ -85,9 +89,10 @@
console.error(`res.error`, res.error);
$snackbarStore.open = true;
$snackbarStore.severity = SNACKBAR_SEVERITY.ERROR;
$snackbarStore.message = "Something isn't right.";
$snackbarStore.message =
"Something isn't right. Please reload and take attendance again";
} else {
console.log('res', JSON.stringify(res));
// console.log('res', JSON.stringify(res));
const { id, is_present } = res.data[0];
if ($attendance[student.id]) {
$attendance[student.id][lesson.id] = {