-
Notifications
You must be signed in to change notification settings - Fork 251
ISSUE-7711: Add GET - api/.../groups/test_results api route #7754
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
base: master
Are you sure you want to change the base?
Conversation
96a9b3c to
79164a0
Compare
Pull Request Test Coverage Report for Build 20196133399Details
💛 - Coveralls |
79164a0 to
5409b7c
Compare
| end | ||
| end | ||
|
|
||
| def test_results |
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 implementation does work, but I would like to see this align with the implementation of the JSON download through the UI, as I don't think it's good to have two different JSON formats exposed.
The existing JSON export makes use of Assignment#summary_test_results. You could add an optional parameter for a group id (or perhaps a list of group ids, which allows more possibilities in the future) to filter the existing query.
Note that the above method only returns the results for the latest test run. I think this is fine for now, since this is aligned with the existing JSON functionality. In the future we could extend this with an option to download all test runs.
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.
Hi David,
Would it be better to update the API call to follow the exiting JSON download structure, or should we update the existing implementation to download all test runs?
Here are the pros and cons of each:
UI format:
Pros:
- Simpler
- Grouped by group_name → test_group_name
New API Format:
Pros:
- Returns all test runs for the group
- Is structured as an array of test_runs with nested test_groups
- Includes metadata like test_run id, status, created_at
I have updated the new API implementation to use the existing the default UI implementation and added the option include_metadata to use the new API JSON format, which returns all test runs.
We can also update the exiting UI download implementation to provide all test runs and meta data.
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.
Hi Mateo, for this PR I want to use exclusively what is already implemented and so please remove the other code from this PR.
If we decide to make changes in the future (to add all test runs) then I would like to do so by modifying the existing method and have it apply to both API and the UI exports. We would also have a discussion about exactly what the API parameters should be (I find the proposed include_metadata to be overly broad).
So please remove the code that you've added and just use the implementation in render_legacy_test_results (by the way, I also do not believe this is an appropriate name, as I do not consider the existing implementation to be "legacy").
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.
Sounds good. Please take another look.
b70f4ab to
97cd94f
Compare
| end | ||
| end | ||
|
|
||
| def test_results |
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.
Hi Mateo, for this PR I want to use exclusively what is already implemented and so please remove the other code from this PR.
If we decide to make changes in the future (to add all test runs) then I would like to do so by modifying the existing method and have it apply to both API and the UI exports. We would also have a discussion about exactly what the API parameters should be (I find the proposed include_metadata to be overly broad).
So please remove the code that you've added and just use the implementation in render_legacy_test_results (by the way, I also do not believe this is an appropriate name, as I do not consider the existing implementation to be "legacy").
|
@david-yz-liu sounds good. |
97cd94f to
a86e33f
Compare
| # This ensures format consistency with the UI download (summary_test_result_json) | ||
| group_name = grouping.group.group_name | ||
| all_results = assignment.summary_test_results | ||
| results = all_results.select { |r| r.group_name == group_name } |
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.
It is better to filter within the Assignment#summary_test_results method itself to avoid loading a lot more test results. I think I saw an earlier comment about managing the nested queries in Assignment#summary_test_results; one suggestion is that you can add a where call immediately before Line 688 in assignment.rb.
a86e33f to
166ed2b
Compare
Proposed Changes
We wish to give users the ability to obtain test results through the API. This PR adds the following endpoint:
GET - /api/courses/:course_id/assignments/:assignment_id/groups/:id/test_results.Screenshots of your changes (if applicable)
Associated documentation repository pull request (if applicable)
Type of Change
(Write an
Xor a brief description next to the type or types that best describe your changes.)Checklist
(Complete each of the following items for your pull request. Indicate that you have completed an item by changing the
[ ]into a[x]in the raw text, or by clicking on the checkbox in the rendered description on GitHub.)Before opening your pull request:
After opening your pull request:
Questions and Comments
This PR references:
GET - api/../groups/test_resultsendpoint documentation