Skip to content

Commit

Permalink
Merge pull request #826 from lamontfr/fix820
Browse files Browse the repository at this point in the history
Fix bug : meal labels date not changing
  • Loading branch information
lamontfr authored Jan 10, 2018
2 parents 844ca09 + d62378d commit 396f86d
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/delivery/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -879,6 +879,7 @@ def get(self, request, *args, **kwargs):
component_lines, # summary
meal_lines) # detail
num_labels = kcr_make_labels( # meal labels as PDF
date,
kitchen_list, # KitchenItems
component_lines[0].name, # main dish name
component_lines[0].ingredients) # main dish ingredients
Expand Down Expand Up @@ -1289,8 +1290,7 @@ def go():
'sortkey', '', # key for sorting
'route', '', # String : Route name
'name', '', # String : Last + First abbreviated
# String : Delivery date
'date', "{}".format(datetime.date.today().strftime("%a, %b-%d")),
'date', '', # String : Delivery date
'size', '', # String : Regular or Large
'main_dish_name', '', # String
'dish_clashes', [], # List of strings
Expand Down Expand Up @@ -1393,7 +1393,8 @@ def draw_label(label, width, height, data):
vertic_pos -= 9


def kcr_make_labels(kitchen_list, main_dish_name, main_dish_ingredients):
def kcr_make_labels(date, kitchen_list,
main_dish_name, main_dish_ingredients):
"""Generate Meal Labels sheets as a PDF file.
Generate a label for each main dish serving to be delivered. The
Expand All @@ -1403,6 +1404,7 @@ def kcr_make_labels(kitchen_list, main_dish_name, main_dish_ingredients):
and ReportLab
Args:
date : The delivery date of the meals.
kitchen_list : A dictionary of KitchenItem objects (see
order/models) which contain detailed information about
all the meals that have to be prepared for the day and
Expand Down Expand Up @@ -1444,6 +1446,7 @@ def kcr_make_labels(kitchen_list, main_dish_name, main_dish_ingredients):
meal_label = MealLabel(*meal_label_fields[1::2])
meal_label = meal_label._replace(
route=kititm.routename.upper(),
date="{}".format(date.strftime("%a, %b-%d")),
main_dish_name=main_dish_name,
name=kititm.lastname + ", " + kititm.firstname[0:2] + ".")
if kititm.meal_size == SIZE_CHOICES_LARGE:
Expand Down

0 comments on commit 396f86d

Please sign in to comment.