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

fix: Handle ticket fee not found error in send monthly invoice #6924

Merged
merged 1 commit into from
Apr 24, 2020

Conversation

codedsun
Copy link
Contributor

Fixes #6869

Short description of what this resolves:

Ticket fee not found error in send monthly invoice

Changes proposed in this pull request:

Skip that entry and log an error

Checklist

  • I have read the Contribution & Best practices Guide and my PR follows them.
  • My branch is up-to-date with the Upstream development branch.
  • The unit tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)
  • All the functions created/modified in this PR contain relevant docstrings.

@auto-label auto-label bot added the fix label Apr 22, 2020
raise ObjectNotFound(
{'source': ''}, 'Ticket Fee not set for {}'.format(currency)
)
app.logger.error('Ticket Fee not found for event id {id}'.format(id=event.id))

Choose a reason for hiding this comment

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

line too long (94 > 90 characters)

@lgtm-com
Copy link
Contributor

lgtm-com bot commented Apr 22, 2020

This pull request introduces 1 alert when merging 464e767 into cd5a273 - view on LGTM.com

new alerts:

  • 1 for Unused import

@codedsun
Copy link
Contributor Author

@iamareebjamal - Am I logging the error in a wrong way?

raise ObjectNotFound(
{'source': ''}, 'Ticket Fee not set for {}'.format(currency)
)
app.logger.error('Ticket Fee not found for event id {id}'.format(id=event.id))
Copy link
Member

Choose a reason for hiding this comment

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

Don't use app.logger

Create a new logger with __name__

raise ObjectNotFound(
{'source': ''}, 'Ticket Fee not set for {}'.format(currency)
)
logging.getLogger(__name__).error('Ticket Fee not found for event id {id}'.format(id=event.id))

Choose a reason for hiding this comment

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

line too long (111 > 90 characters)

@codecov
Copy link

codecov bot commented Apr 23, 2020

Codecov Report

Merging #6924 into development will decrease coverage by 0.00%.
The diff coverage is 50.00%.

Impacted file tree graph

@@               Coverage Diff               @@
##           development    #6924      +/-   ##
===============================================
- Coverage        66.40%   66.39%   -0.01%     
===============================================
  Files              313      313              
  Lines            15358    15360       +2     
===============================================
+ Hits             10198    10199       +1     
- Misses            5160     5161       +1     
Impacted Files Coverage Δ
app/api/helpers/scheduled_jobs.py 48.29% <50.00%> (+0.02%) ⬆️
app/templates/flask_ext/jinja/filters.py 57.14% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update cd5a273...5ea2440. Read the comment docs.

@codedsun
Copy link
Contributor Author

@iamareebjamal - Review

raise ObjectNotFound(
{'source': ''}, 'Ticket Fee not set for {}'.format(currency)
)
logging.getLogger(__name__)\
Copy link
Member

Choose a reason for hiding this comment

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

No

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@iamareebjamal - Shall I create a global variable logger here?

logger = logging.getLogger(__name__)

Copy link
Member

Choose a reason for hiding this comment

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

Yes

@iamareebjamal iamareebjamal changed the title fix: Ticket fee not found error in send monthly invoice fix: Handle ticket fee not found error in send monthly invoice Apr 24, 2020
@iamareebjamal iamareebjamal merged commit 67beff7 into fossasia:development Apr 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error while sending monthly invoice
3 participants