diff --git a/eodb/events/management/commands/punchcard.py b/eodb/events/management/commands/punchcard.py index 865ffea..3f29d0b 100644 --- a/eodb/events/management/commands/punchcard.py +++ b/eodb/events/management/commands/punchcard.py @@ -16,11 +16,18 @@ class Command(GraphCommand): if options.get('committime'): datetime_var = 'commit_datetime' + def hour_shift(x): + x = x - 4 + if x < 0: + x += 24 + return x + for commit in self.get_events(options): - coords = (getattr(commit, datetime_var).weekday(), getattr(commit, datetime_var).hour) + coords = (getattr(commit, datetime_var).weekday(), hour_shift(getattr(commit, datetime_var).hour)) infos[coords] = infos[coords] + 1 - draw_punchcard(infos) + draw_punchcard(infos, + ax2_ticks=list(range(4, 24)) + list(range(4))) self.plot(options) # https://stackoverflow.com/a/14850998