From 20794c37aaa0d159b0a378e0035a01a7aa6a64a6 Mon Sep 17 00:00:00 2001 From: domonkosadam Date: Thu, 2 Jan 2025 10:44:25 +0100 Subject: [PATCH 1/3] Fix assignment labels --- apps/flutter_parent/lib/models/assignment.dart | 4 ++-- .../screens/assignments/assignment_details_screen.dart | 9 +++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/apps/flutter_parent/lib/models/assignment.dart b/apps/flutter_parent/lib/models/assignment.dart index db39f7be6d..bace47a2f6 100644 --- a/apps/flutter_parent/lib/models/assignment.dart +++ b/apps/flutter_parent/lib/models/assignment.dart @@ -148,13 +148,13 @@ abstract class Assignment implements Built { SubmissionStatus getStatus({required String? studentId}) { final submission = this.submission(studentId); - if (!isSubmittable() && submission == null) { + if ((!isSubmittable() && submission == null) || (!isSubmittable()) && submission?.isGraded() == false) { return SubmissionStatus.NONE; } else if (submission?.isLate == true) { return SubmissionStatus.LATE; } else if (_isMissingSubmission(studentId)) { return SubmissionStatus.MISSING; - } else if (submission?.submittedAt == null) { + } else if (submission?.submittedAt == null && submission?.isGraded() == false) { return SubmissionStatus.NOT_SUBMITTED; } else { return SubmissionStatus.SUBMITTED; diff --git a/apps/flutter_parent/lib/screens/assignments/assignment_details_screen.dart b/apps/flutter_parent/lib/screens/assignments/assignment_details_screen.dart index 98af4eae28..6650e386de 100644 --- a/apps/flutter_parent/lib/screens/assignments/assignment_details_screen.dart +++ b/apps/flutter_parent/lib/screens/assignments/assignment_details_screen.dart @@ -149,7 +149,8 @@ class _AssignmentDetailsScreenState extends State { final missing = submission?.missing == true; final showStatus = missing || assignment.isSubmittable() || submission?.isGraded() == true; final submitted = submission?.submittedAt != null; - final submittedColor = submitted ? ParentTheme.of(context)?.successColor : textTheme.bodySmall?.color; + final graded = submission?.isGraded() == true; + final submittedColor = submitted || graded ? ParentTheme.of(context)?.successColor : textTheme.bodySmall?.color; final points = (assignment.pointsPossible.toInt() == assignment.pointsPossible) ? assignment.pointsPossible.toInt().toString() @@ -173,13 +174,13 @@ class _AssignmentDetailsScreenState extends State { semanticsLabel: l10n.assignmentTotalPointsAccessible(points), key: Key("assignment_details_total_points")), if (showStatus && !restrictQuantitativeData) SizedBox(width: 16), - if (showStatus) _statusIcon(submitted, submittedColor!), + if (showStatus) _statusIcon(submitted || graded, submittedColor!), if (showStatus) SizedBox(width: 8), if (showStatus) Text( missing ? l10n.assignmentMissingSubmittedLabel : - !submitted ? l10n.assignmentNotSubmittedLabel : - submission?.isGraded() == true ? l10n.assignmentGradedLabel : l10n.assignmentSubmittedLabel, + graded ? l10n.assignmentGradedLabel : + submitted ? l10n.assignmentSubmittedLabel : l10n.assignmentNotSubmittedLabel, style: textTheme.bodySmall?.copyWith( color: submittedColor, ), From 0a16e99d1d415ace2bf6da0ca3bfaafc5cb2ca7b Mon Sep 17 00:00:00 2001 From: domonkosadam Date: Thu, 2 Jan 2025 13:44:47 +0100 Subject: [PATCH 2/3] Fix parenthesis --- apps/flutter_parent/lib/models/assignment.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/flutter_parent/lib/models/assignment.dart b/apps/flutter_parent/lib/models/assignment.dart index bace47a2f6..057546815b 100644 --- a/apps/flutter_parent/lib/models/assignment.dart +++ b/apps/flutter_parent/lib/models/assignment.dart @@ -148,7 +148,7 @@ abstract class Assignment implements Built { SubmissionStatus getStatus({required String? studentId}) { final submission = this.submission(studentId); - if ((!isSubmittable() && submission == null) || (!isSubmittable()) && submission?.isGraded() == false) { + if ((!isSubmittable() && submission == null) || (!isSubmittable() && submission?.isGraded() == false)) { return SubmissionStatus.NONE; } else if (submission?.isLate == true) { return SubmissionStatus.LATE; From 54b641266e8b1719931942668cfacb881f10a6e0 Mon Sep 17 00:00:00 2001 From: domonkosadam Date: Tue, 7 Jan 2025 14:38:24 +0100 Subject: [PATCH 3/3] Fix not submitted label --- apps/flutter_parent/lib/models/assignment.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/flutter_parent/lib/models/assignment.dart b/apps/flutter_parent/lib/models/assignment.dart index 057546815b..fadb6aa113 100644 --- a/apps/flutter_parent/lib/models/assignment.dart +++ b/apps/flutter_parent/lib/models/assignment.dart @@ -154,7 +154,7 @@ abstract class Assignment implements Built { return SubmissionStatus.LATE; } else if (_isMissingSubmission(studentId)) { return SubmissionStatus.MISSING; - } else if (submission?.submittedAt == null && submission?.isGraded() == false) { + } else if (submission?.submittedAt == null && (submission?.isGraded() ?? false) == false) { return SubmissionStatus.NOT_SUBMITTED; } else { return SubmissionStatus.SUBMITTED;