-
Notifications
You must be signed in to change notification settings - Fork 14
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
Return actual value for roster last_updated #6913
base: main
Are you sure you want to change the base?
Conversation
95caeb1
to
4d5d4de
Compare
lms/services/roster.py
Outdated
.where(AssignmentRoster.assignment_id == assignment.id) | ||
.limit(1) | ||
) | ||
def assignment_roster_exists(self, assignment: Assignment) -> datetime | None: |
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.
Changing this from returning a boolean to returning a date or None.
@@ -84,7 +85,7 @@ def __init__(self, request) -> None: | |||
schema=ListUsersSchema, | |||
) | |||
def students(self) -> APIStudents: | |||
students_query = self._students_query( | |||
_, students_query = self._students_query( |
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.
We don't care about last_udpated for the dropdowns, ignoring the value there.
@@ -211,7 +210,7 @@ def _students_query( | |||
assignment_ids: list[int], | |||
segment_authority_provided_ids: list[str], | |||
h_userids: list[str] | None = None, | |||
): | |||
) -> tuple[datetime | None, Select]: |
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 type anno helped find where we need to start returning a tuple
9168cf6
to
7d79381
Compare
Return the greatest date we have for a given roster or None for cases where we still base the roster data on launches.
Only return the last_update when the roster data is returned to the client. Avoid returning it when we do have that roster data but the feature is disabled.
From assignment_roster_exists to assignment_roster_last_updated Co-authored-by: Alejandro Celaya <[email protected]>
7d79381
to
a9adfab
Compare
@@ -217,46 +217,53 @@ def test_get_request_admin_organizations_for_staff( | |||
|
|||
assert svc.get_request_admin_organizations(pyramid_request) == [organization] | |||
|
|||
@pytest.mark.parametrize("rosters_enabled", [True, False]) | |||
@pytest.mark.parametrize("roster_available", [True, False]) |
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.
Combined a couple of test into this one, adding all the combinations of enabled/disabled with the data available/missing.
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.
LGTM, and works as expected.
We have been returning
None
for all entries until now.Actually return the value on the DB for roster entries and
None
for the ones based on launches.Testing
https://hypothesis.instructure.com/courses/125/assignments/873
You'll see the
Full roster data for this assignment is not available. This only shows students who have previously launched it.
message.
http://localhost:8001/admin/instances/102/settings
Enable roster data
.https://hypothesis.instructure.com/courses/319/assignments/3336
make shell
:Open the dashboard, you'll get the roster updated date on the top right corner.
Repeat with the AI setting disabled:
http://localhost:8001/admin/instances/102/settings
The top right notice will be gone and you will fallback to launches data.