Example #1
0
 def boxes_by_day(self, year, month, day):
     width = 696
     today = datetime.datetime(year=int(year), month=int(month), day=int(day))
     
     plate_runtimes = sorted(plate_runtimes_for_day_box(today), key=lambda tup: (tup[0].plate.box2.name, tup[1]))
     
     day_begin = midnight(today)
     day_end = second_before_midnight(today)
     plate_runtime_dimensions = [(plate, start, end, int((width*round((start-day_begin).total_seconds())/(60*60*24))),
                                         max(1,int((width*round((end-start).total_seconds())/(60*60*24))))) for plate, start, end in plate_runtimes]
     c.run_histories = [(machine, list(events)) for machine, events in itertools.groupby(plate_runtime_dimensions, lambda tup: tup[0].plate.box2.name)]
     
     c.today = today
     c.yesterday = today - datetime.timedelta(1)
     c.tomorrow = today + datetime.timedelta(1)
     c.weeks_ago = (datetime.datetime.now() - today).days/7
     return render('/stats/box2_day.html')
Example #2
0
def plate_runtimes_for_day_box(day):
    day_start = midnight(day)
    day_end = second_before_midnight(day)
    return plate_runtimes_for_box_range(day_start, day_end)