Skip to content

Commit

Permalink
Merge pull request #65 from aliassheikh/DD-1625-Dont-send-emails-when…
Browse files Browse the repository at this point in the history
…-report-is-empty

DD-1625 deposit-create-report: stuur geen report als er geen records zijn
  • Loading branch information
janvanmansum authored Aug 23, 2024
2 parents be4c6cf + 505c45f commit 19e3215
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/datastation/deposit_create_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,13 @@ def handle_request(self):
if output_file == '-':
print(report)
else:
self.save_report_to_file(report, output_file)
if len(report.split('\n')) > 1:
self.save_report_to_file(report, output_file)

if self.__command_line_args.email_to is not None:
self.send_report_mail(output_file)
if self.__command_line_args.email_to is not None:
self.send_report_mail(output_file)
else:
print("Report is empty.")

def save_report_to_file(self, report, output_file):
with open(output_file, 'w') as output:
Expand Down

0 comments on commit 19e3215

Please sign in to comment.