Skip to content

Commit

Permalink
集計データが存在しないときエラー終了する問題を修正
Browse files Browse the repository at this point in the history
  • Loading branch information
mypaceshun committed Sep 28, 2020
1 parent be3a83c commit 36fbcad
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions akerun_sum/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ['氏名', '就業日数', '就業時間']
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 36fbcad

Please sign in to comment.