-
Notifications
You must be signed in to change notification settings - Fork 3
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
Create Grading Service Part 2 (POST /cs3213/feedback_error
and a GET endpoint to obtain submission with feedbacks)
#30
Conversation
…backs and submission (for now only one submission allowed, user can submit multiple times, but only the latest submission is stored), and a GET /questions/:questionId/submissions endpoint to retrieve submission.
…nd-Management-System into tryyang/create_grading_service
/cs3213/feedback_error
and a GET endpoint to obtain submission with feedbacks)
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!
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! beside few very minor code quality that I left reviews, all sample requests from Postman json file work for me, however:
- due to complexity of the techstack you are using, maybe can consider create a README.md file with few simple instruction on how to build/run the service locally
- add
yarn prisma generate
to the package.json file scripts under build
@@ -18,6 +66,22 @@ const postParser = async (request: Request, response: Response) => { | |||
|
|||
response.status(HttpStatusCode.OK).json({ parser }); | |||
} catch (error) { | |||
if (error instanceof ITSPostParserError) { | |||
if (error.errorField === "language") { | |||
response.status(HttpStatusCode.BAD_REQUEST).json({ |
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 look like DRY to me cause this piece of code appear in other place, I think you can consider exporting an method that set response status and json body from ITSPostParserError.ts and invoke it
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.
Oh okay, tbh the actual reason was that the ITS response on error is not very clear and consistent, so I was just using a simple way to distinguish what happens... Will polish this in the future.
… a README and ATTRIBUTIONS for easing setting up the project locally
Pull Request
Description
Part 2 of grading service implementation. Created the API wrapper for the POST
/cs3213/feedback_error
endpoint. Also created a GET/questions/:questionId/submissions?studentId=xxx
endpoint to allow retrieving generated feedbacks for the same submission without calling the ITS API again.To explain further, the wrapper for POST
/cs3213/feedback_error
endpoint has the API path of/grading/api/feedback/generate
, which also uses POST method. Instead of taking non-human-readable code parser as input request body, it only takes the JSON-friendly actual source code, the language (only support "python" or "c"), the question id and the student id. In short, the request body to POST/grading/api/feedback/generate
should have this format, see example:The response of this
generateFeedback
endpoint is shown in the screenshot section.Related Issue(s)
Closes #20
Screenshots (if applicable)
Above is the example request and response of GET
/grading/api/questions/:questionId/submissions
endpoint.And this is the example request and response of POST
/grading/api/feedback/generate
endpoint.Checklist
master
or any destination branch.Additional Notes/References
As the next step of action, I will add more proper error checking, create unit tests, and the API docs for grading service. One potential issue is that calling POST
/grading/api/feedback/generate
is extremely slow, as ITS API takes quite long to generate the output, and the code parser can be very long.