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

Migrate filtering to the Backend #1065

Merged
merged 33 commits into from
Feb 23, 2024

Conversation

GabrielCWT
Copy link
Contributor

@GabrielCWT GabrielCWT commented Feb 14, 2024

  • Implement pagination through limit and offset
  • Refactor code in assessments to use ecto querying instead of raw sql
  • Implement filtering using query parameters
  • Change response for AdminGradingController :index to return an object with "count" and "data" instead of an array of submissions. Where "count" is the total number of submissions for the query (For pagination) and "data" is the array of submissions.
  • Update assessment tests to account for change in response.
  • Update Notification/Email tests to account for change in response

Resolves #926

@GabrielCWT
Copy link
Contributor Author

GabrielCWT commented Feb 14, 2024

TODO:

  • Refactor code
  • Update tests to account for change in response
  • Format once all refactoring is done

@coveralls
Copy link

coveralls commented Feb 15, 2024

Coverage Status

coverage: 94.981% (-0.3%) from 95.316%
when pulling fa2cb80 on GabrielCWT:gabriel/pagination
into dd89ec9 on source-academy:master.

@GabrielCWT GabrielCWT marked this pull request as ready for review February 15, 2024 09:12
@RichDom2185 RichDom2185 self-requested a review February 16, 2024 10:37
@josh1248
Copy link
Contributor

(minor change) hi gabriel, i think the filter now to restrict views runs only when group == true, but this value represents showAllGroups. Hence, the intended functionality is actually flipped. Could you help to update this to false? Apologies for the late comment. Thank you! (Assessments.ex 1430)

@GabrielCWT
Copy link
Contributor Author

GabrielCWT commented Feb 17, 2024

(minor change) hi gabriel, i think the filter now to restrict views runs only when group == true, but this value represents showAllGroups. Hence, the intended functionality is actually flipped. Could you help to update this to false? Apologies for the late comment. Thank you! (Assessments.ex 1430)

@josh1248 To my knowledge it is meant to be whether "only the groups under the grader should be returned". See the old function all_submissions_by_grader_for_index in line 1244. There is a doc which explains it

@josh1248
Copy link
Contributor

okies, updated to match!

@RichDom2185
Copy link
Member

Relevant frontend PR: source-academy/frontend#2787

Copy link
Member

@RichDom2185 RichDom2185 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! The builder pattern makes it really clean haha.

Are we going to do away with the old routes? What was the additional controller for?

lib/cadet/assessments/assessments.ex Outdated Show resolved Hide resolved
@GabrielCWT
Copy link
Contributor Author

@RichDom2185 I can remove the old stuff in assessments.ex and admin_grading_controller.ex if everything looks good. With regards to the routes, I'm not too sure which old routes you are talking about since we are using the same route as before.

@RichDom2185
Copy link
Member

@RichDom2185 I can remove the old stuff in assessments.ex and admin_grading_controller.ex if everything looks good. With regards to the routes, I'm not too sure which old routes you are talking about since we are using the same route as before.

Sorry, by "routes" I meant the old stuff you mentioned. But yes, I think it's fine to remove, since we're aiming for a breaking change, not a safe migration (in which case we would have both old and new functions first, then migrate frontend to new, then delete old entirely – that way there would be no downtime).

@GabrielCWT
Copy link
Contributor Author

@RichDom2185 I can remove the old stuff in assessments.ex and admin_grading_controller.ex if everything looks good. With regards to the routes, I'm not too sure which old routes you are talking about since we are using the same route as before.

Sorry, by "routes" I meant the old stuff you mentioned. But yes, I think it's fine to remove, since we're aiming for a breaking change, not a safe migration (in which case we would have both old and new functions first, then migrate frontend to new, then delete old entirely – that way there would be no downtime).

@RichDom2185 There is still the ungraded_only param which is unresolved, not too sure what it does so I will leave the TODO comment on top of the new function.

@GabrielCWT
Copy link
Contributor Author

Resolves #926

@GabrielCWT GabrielCWT added the Enhancement New feature or request label Feb 21, 2024
@GabrielCWT
Copy link
Contributor Author

@RichDom2185 could you look through 2e3be04, I wasn't sure if notGradedFully should fall under the submissions builder

@RichDom2185
Copy link
Member

@RichDom2185 could you look through 2e3be04, I wasn't sure if notGradedFully should fall under the submissions builder

Looks good!

Copy link
Member

@RichDom2185 RichDom2185 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks a lot!

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

Successfully merging this pull request may close these issues.

Paginate /grading API response
4 participants