Skip to content
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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

marcospri
Copy link
Member

@marcospri marcospri commented Dec 11, 2024

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

  • Open a LT1.1 assignment for which you have at least one student launch. Open the dashboard for it.

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.

  • Make sure you have the application instance setting enabled:

http://localhost:8001/admin/instances/102/settings

Enable roster data.

  • Open a LTI1.3 assignment

https://hypothesis.instructure.com/courses/319/assignments/3336

  • Make sure you have a roster for it, on make shell:
from lms.tasks.roster import schedule_fetching_rosters
schedule_fetching_rosters.delay()
  • 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.

Base automatically changed from roster-dashboard-api-active to main December 11, 2024 11:14
@marcospri marcospri force-pushed the roster-dashboard-api-last-updated branch 2 times, most recently from 95caeb1 to 4d5d4de Compare December 11, 2024 14:43
@marcospri marcospri changed the title Roster dashboard api last updated Return actual value for roster last_updated Dec 16, 2024
@marcospri marcospri requested a review from acelaya December 16, 2024 08:53
.where(AssignmentRoster.assignment_id == assignment.id)
.limit(1)
)
def assignment_roster_exists(self, assignment: Assignment) -> datetime | None:
Copy link
Member Author

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(
Copy link
Member Author

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]:
Copy link
Member Author

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

lms/services/roster.py Outdated Show resolved Hide resolved
@marcospri marcospri force-pushed the roster-dashboard-api-last-updated branch from 9168cf6 to 7d79381 Compare December 16, 2024 11:38
marcospri and others added 3 commits December 16, 2024 14:49
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]>
@marcospri marcospri force-pushed the roster-dashboard-api-last-updated branch from 7d79381 to a9adfab Compare December 16, 2024 13:49
@marcospri marcospri requested a review from acelaya December 16, 2024 13:55
@@ -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])
Copy link
Member Author

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.

Copy link
Contributor

@acelaya acelaya left a 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants