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

RDISCROWD-7573 update error on nonexistent project id in task API #989

Merged
merged 5 commits into from
Nov 7, 2024

Conversation

n00rsy
Copy link

@n00rsy n00rsy commented Oct 30, 2024

Issue number of the reported bug or feature request: RDISCROWD-7573

Describe your changes
add project null check after fetching project info in _preprocess_post_data

@n00rsy n00rsy changed the title RDISCROWD-7573 RDISCROWD-7573 update error on nonexistent project id in task API Oct 30, 2024
@coveralls
Copy link

coveralls commented Oct 30, 2024

Pull Request Test Coverage Report for Build 11712107488

Details

  • 3 of 3 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 94.016%

Totals Coverage Status
Change from base Build 11559628491: 0.0%
Covered Lines: 17362
Relevant Lines: 18467

💛 - Coveralls

@@ -102,6 +102,8 @@ def _preprocess_post_data(self, data):
if 'n_answers' not in data:
project = project_repo.get(project_id)
data['n_answers'] = project.get_default_n_answers()
if not project:
raise BadRequest(f'Non existing project id {project_id}')

Choose a reason for hiding this comment

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

Are any other details of the request available inside data[] that would help identify the caller? If so, those could be included in the exception details.

Copy link
Author

Choose a reason for hiding this comment

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

Please see the ticket comments for planned work on the gigwork listener to add identification for the caller. Thanks!

Copy link

@dchhabda dchhabda left a comment

Choose a reason for hiding this comment

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

Feel free to add test that will cover newly added condition and exception. Thanks

@n00rsy n00rsy merged commit 76cadd2 into main Nov 7, 2024
6 checks passed
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.

4 participants