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
There are no contributions for the given time range #19264
Comments
Analysis from #19388 by @chris7716: Currently 'There are no contributions for the given time range.' is thrown as an internal server error. Modifying the function's signature to return ContributorCertificateInfo|None and have the caller handle the None case correctly would be the better solution. |
Hello! This is my first time contributing to Oppia. All of the documentation is definitely appreciated! As @chris7716 mentioned, this error is thrown by the server when no contributions have been found. Suggestion_services.py sums the total word count of all translation contributions found, and if that word count is still zero, then the exception is raised. Taking @chris7716's advice, I would change this check of the word count to instead return None, and then also change the calling method in the suggestion_services.py (generate_contributor_certificate_data) to return None as well in this case. Then contributor_dashboard.py can still do self.render_json(response), and if response was None, it will just be written as a null value that we can handle on the client side. Finally, in the client we handle it in certificate-download-modal.components.ts like this: That should do it. By the way, at first, I wasn't able to view the Accomplishments tab in the Contributor Dashboard. I had to manually set accomplishmentsTabIsEnabled to true in order to test this (which obviously would not be part of this PR). Is there another way to enable the Accomplishments tab from within UI, or has this been disabled? |
@mgporter This looks like a good approach, thanks! I'm assigning you, feel free to make a PR :) (When can you make it, btw?) Re the feature flag, sign in as an admin locally, then go to /admin > Roles and give yourself the Release Coordinator role. Then go to /release-coordinator to turn it on. (That said, the accomplishments tab is here to stay, so if you like I think it is fine to remove the feature flag altogether and set it to permanently display, but maybe that should be a separate PR.) Hope that helps, and feel free to ask if you have any further questions -- thanks! |
Thanks for the tip about the feature flag. I can make the PR within the next day most likely (I won't touch the feature flag right now though). Working on this, I discovered a few other issues with the certificate-download-modal component. Would you mind if I made another PR and worked on these issues?
|
@mgporter Thanks! Definitely open to these improvements; they sound good. Could you please file an issue for them, so that we can assign you to it? Maybe file (1)+(2) as one issue and (3) as a separate one -- I'm not sure about what the UI for (3) would be, so let's validate that before assigning work on it. |
Ok, just created the PR. I think I covered everything in the guidelines. Thanks for the feedback- I'll make sure to do that! |
Created tests for PR oppia#19264 for the frontend and backend. generate_contributor_certificate_data in suggestion_services.py can now return None, so some function's return values were changed to Optional[ContributorCertificateInfoDict]. Tests were added on the frontend, and tests on the backend had to be changed to "assert response is not None" rather than "self.assertIsNotNone(response)" in order to satisfy the type checker. Notably, "None" also had to be added to the union type parameter in the render_json function in controllers/base.py for this reason as well.
Added CertificateDataResponse datatype to hold the certificate data or None. Added documentation for python asserts in tests. Some variable names, docstrings, and indentation were also updated.
This error occurred recently in production:
Where did the error occur? Add the page the error occurred on.
Frequency of occurrence Add details about how many times the error occurred within a given time period (e.g. the last week, the last 30 days, etc.). This helps issue triagers establish severity.
4 times in a day.
General instructions for contributors
In general, the procedure for fixing server errors should be the following:
The text was updated successfully, but these errors were encountered: