-
Notifications
You must be signed in to change notification settings - Fork 111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix issue with assignments without grading period not being shown on Assignment List #2969
base: master
Are you sure you want to change the base?
Conversation
Release Note:Fixed an issue where assignments that don't belong to any of the available grading periods were not shown at Assignments. Affected Apps: Student, Teacher❌ XCTest failed: CoreTests/CourseSyncGradesInteractorLiveTests/testSuccessfulSync
❌ XCTest failed: CoreTests/GetAssignmentsByGroupTests/testFetchesAssignmentsForEachGradingPeriod
❌ XCTest failed: CoreTests/GetAssignmentsByGroupTests/testFetchesAssignmentsForEachGradingPeriodAndReturnsAssignmentsForAGradingPeriod
❌ XCTest failed: CoreTests/GetAssignmentsByGroupTests/testFetchesAssignmentsForEachGradingPeriodWhenHideGradeIsFalse
|
affects: Student, Teacher release note: Fixed an issue where assignments that don't belong to any of the available grading periods were not shown at Assignments. test plan: See ticket.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code +1
Core/Core/Assignments/AssignmentList/ViewModel/AssignmentListViewModel.swift
Outdated
Show resolved
Hide resolved
For the intended change, it seems working good. But current period selection is always set to a specific value (here it is Spring) on screen appearance. So, if you change the viewed period to different one, and went into seeing an assignment details, when backing to the assignments list screen you'd always reset to that default period. Which doesn't seem intuitive. See record below: current_period_selection_reset_issue.mp4 |
@suhaibabsi-inst I have addressed your suggestions. Please check again. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code review + 1 (minus the tests that need updating)
if self?.selectedGradingPeriod == nil { | ||
self?.defaultGradingPeriod = self?.currentGradingPeriod | ||
self?.selectedGradingPeriod = self?.defaultGradingPeriod |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would add a guard let self else { return }
before all this nil comparisons and assignments, even it is not strictly needed.
isFilterIconSolid = (1 ..< AssignmentFilterOption.allCases.count).contains(selectedFilterOptions.count) | ||
|| selectedGradingPeriod != defaultGradingPeriod |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This logic is different then the one in filterOptionsDidUpdate()
.
Is it intentional? Why is this logic needed here if the value is set just before it (at the end of that method)
Regardless I would extract two pieces of logic, because they are used in multiple places:
private var isFilteringCustom: Bool {
// all filters selected is the same as no filter selected
selectedFilterOptions.isNotEmpty && selectedFilterOptions.count != AssignmentFilterOption.allCases.count
}
private func updateFilterIcon() {
isFilterIconSolid = ...
}
} | ||
assignmentGroups.forEach { group in | ||
let groupAssignments: [Assignment] = assignments.filter { $0.assignmentGroup == group } | ||
if !groupAssignments.isEmpty { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if !groupAssignments.isEmpty { | |
guard groupAssignments.isNotEmpty else { return } |
@@ -189,6 +194,12 @@ public class AssignmentListViewModel: ObservableObject { | |||
} | |||
|
|||
private func filterAssignments(_ assignments: [Assignment]) -> [Assignment] { | |||
// Filtering by grading period except if all is selected (nil) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Filtering by grading period except if all is selected (nil) | |
// Filtering by grading period except if "All" is selected (nil) |
to clarify (without needing to check elsewhere) that All is an option, not all of the options
refs: MBL-18023
affects: Student, Teacher
release note: Fixed an issue where assignments that don't belong to any of the available grading periods were not shown at Assignments.
test plan: Log in with an account that has multiple grading periods and assignments that don't belong to any of those grading periods, and check Assignment List if they are showing all of the assignments properly.
Details
Test
Attila's account is a good one for this.
File Upload 4 Copy
is one of the assignments that weren't shown previously. You can see it in the screenshots.See ticket for account info.
Screenshots
Assignment List
Checklist