Skip to content

Commit

Permalink
Do not send transaction history email when there are no transactions …
Browse files Browse the repository at this point in the history
…to show.
  • Loading branch information
bartromgens committed Dec 2, 2014
1 parent 6d2f8a6 commit af676b2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions base/mailnotification.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def create_transaction_history_table_html(userprofile, date_start, date_end):
transactions_in_timerange.append(transaction)

if not transactions_in_timerange:
return 'No shares in date range.'
return ''
transaction_table = '<table>'
transaction_table += '<tr align=\'left\'>'
transaction_table += '<th><b>&#8364;/pp</b></th>'
Expand Down Expand Up @@ -41,7 +41,7 @@ def create_transaction_real_history_table_html(userprofile, date_start, date_end
transactions_in_timerange.append(transaction)

if not transactions_in_timerange:
return 'No transactions in date range.'
return ''
transaction_table = '<table style="font-size: 12px">'
transaction_table += '<tr align=\'left\'>'
transaction_table += '<th><b>&#8364;</b></th>'
Expand Down
2 changes: 2 additions & 0 deletions userprofile/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ def send_transaction_history(self, force_send=False):
transactionTableHtml = mailnotification.create_transaction_history_table_html(self, date_start, date_end)
transactionRealTable = mailnotification.create_transaction_real_history_table_html(self, date_start, date_end)

if transactionTableHtml == '' and transactionRealTable == '':
return
emailserver.send_transaction_history(self.user.username, self.user.email, transactionTableHtml, transactionRealTable, date_start, date_end)

@staticmethod
Expand Down

0 comments on commit af676b2

Please sign in to comment.