From 36fbcad922015d9dd03181f223bdcc096d123d64 Mon Sep 17 00:00:00 2001 From: KAWAI Shun Date: Mon, 28 Sep 2020 11:11:04 +0900 Subject: [PATCH] =?UTF-8?q?=E9=9B=86=E8=A8=88=E3=83=87=E3=83=BC=E3=82=BF?= =?UTF-8?q?=E3=81=8C=E5=AD=98=E5=9C=A8=E3=81=97=E3=81=AA=E3=81=84=E3=81=A8?= =?UTF-8?q?=E3=81=8D=E3=82=A8=E3=83=A9=E3=83=BC=E7=B5=82=E4=BA=86=E3=81=99?= =?UTF-8?q?=E3=82=8B=E5=95=8F=E9=A1=8C=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- akerun_sum/cli.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/akerun_sum/cli.py b/akerun_sum/cli.py index 041ca45..ffbdd3f 100644 --- a/akerun_sum/cli.py +++ b/akerun_sum/cli.py @@ -133,6 +133,10 @@ def output_data0(filename, encode, shaped_data): day_list.append(timecard['day']) day_list.sort() + if len(shaped_data) == 0: + click.echo("output data is empty") + return + period = shaped_data[0]['period'] header = ['氏名', '就業日数', '就業時間'] @@ -196,6 +200,10 @@ def output_data0(filename, encode, shaped_data): def output_data1(filename, encode, shaped_data): + if len(shaped_data) == 0: + click.echo("output data is empty") + return + with codecs.open(filename, 'w', encode) as f: writer = csv.writer(f, lineterminator=os.linesep) for data in shaped_data: