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

feat: Event Invoice Refactor #7279

Merged
merged 7 commits into from
Sep 24, 2020

Conversation

iamareebjamal
Copy link
Member

@iamareebjamal iamareebjamal commented Sep 21, 2020

@lgtm-com
Copy link
Contributor

lgtm-com bot commented Sep 21, 2020

This pull request introduces 1 alert when merging 7a90f4e into 98a7563 - view on LGTM.com

new alerts:

  • 1 for Unused import

)
send_notif_monthly_fee_payment(
self.user,
event.name,

Choose a reason for hiding this comment

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

undefined name 'event'

link = '{}/invoices/{}'.format(frontend_url, self.identifier)
send_email_for_monthly_fee_payment(
self.user.email,
event.name,

Choose a reason for hiding this comment

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

undefined name 'event'

)

return self.invoice_pdf_url

Choose a reason for hiding this comment

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

blank line contains whitespace

currency = self.event.payment_currency
ticket_fee_object = db.session.query(TicketFees).filter_by(currency=currency).first()
if not ticket_fee_object:
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.

undefined name 'event'

def generate_pdf(self):
admin_info = get_settings()
currency = self.event.payment_currency
ticket_fee_object = db.session.query(TicketFees).filter_by(currency=currency).first()

Choose a reason for hiding this comment

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

line too long (93 > 90 characters)

@@ -43,26 +51,88 @@ class EventInvoice(SoftDeletionModel):
stripe_token = db.Column(db.String)
paypal_token = db.Column(db.String)
status = db.Column(db.String, default='due')

Choose a reason for hiding this comment

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

blank line contains whitespace

from app.models import db
from app.models.base import SoftDeletionModel
from app.models.order import Order

Choose a reason for hiding this comment

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

'app.models.order.Order' imported but unused

@lgtm-com
Copy link
Contributor

lgtm-com bot commented Sep 22, 2020

This pull request introduces 7 alerts when merging 887c1af into 98a7563 - view on LGTM.com

new alerts:

  • 7 for Unused import



def get_new_id():
return get_new_identifier(EventInvoice)
return 'I' + get_new_identifier(EventInvoice, length=8)

Choose a reason for hiding this comment

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

Black would make changes.

@@ -8,7 +8,7 @@
from sqlalchemy import event
from sqlalchemy.sql import func

from app.api.helpers.db import get_count
from app.api.helpers.db import get_count, get_new_identifier

Choose a reason for hiding this comment

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

'app.api.helpers.db.get_count' imported but unused

@@ -351,6 +352,8 @@ def create_save_pdf(
dir_path='/static/uploads/pdf/temp/',
identifier=get_file_name(),
upload_dir='static/media/',
new_renderer=False,
extra_identifiers={},

Choose a reason for hiding this comment

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

Do not use mutable data structures for argument defaults. They are created during function definition time. All calls to the function reuse this one instance of that data structure, persisting changes between them.

@lgtm-com
Copy link
Contributor

lgtm-com bot commented Sep 23, 2020

This pull request introduces 10 alerts when merging 38d7cc1 into 459965b - view on LGTM.com

new alerts:

  • 10 for Unused import

def test_send_monthly_invoice(db):
"""Method to test monthly invoices"""

TicketFeesFactory(service_fee=10.23, maximum_fee=11)
TicketFeesFactory(service_fee=10.23, maximum_fee=11, country='global')

Choose a reason for hiding this comment

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

Black would make changes.

@@ -305,7 +305,7 @@
'subject': u'{date} - Monthly service fee invoice for {event_name}',
'message': (
u"The total service fee for the ticket sales of {event_name} in the month of {date} is {amount}."
+ u"<br/> That payment for the same has to be made in two weeks. <a href='{payment_url}'>Click here</a> to "
+ u"<br/> That payment for the same has to be made in 30 days. <a href='{payment_url}'>Click here</a> to "

Choose a reason for hiding this comment

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

line too long (118 > 90 characters)

@celery.task(base=RequestContextTask, name='send.monthly.event.invoice')
def send_monthly_event_invoice():
events = Event.query.filter_by(deleted_at=None, state='published').all()
events = Event.query.filter_by(deleted_at=None).filter(Event.owner != None).all()

Choose a reason for hiding this comment

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

comparison to None should be 'if cond is not None:'

@iamareebjamal iamareebjamal changed the title wip: Event Invoice Refactor feat: Event Invoice Refactor Sep 24, 2020
@iamareebjamal iamareebjamal merged commit 79e7a6a into fossasia:development Sep 24, 2020
@iamareebjamal iamareebjamal deleted the event-invoice-ref branch September 24, 2020 01:57
@lgtm-com
Copy link
Contributor

lgtm-com bot commented Sep 24, 2020

This pull request introduces 1 alert when merging e86d4e9 into 8be1450 - view on LGTM.com

new alerts:

  • 1 for Unused import

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.

Organizer Invoice Generation HTML to PDF template
2 participants