Compare commits
2
Commits
22f997b15c
...
a0fa4a9d4d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a0fa4a9d4d | ||
|
|
0b760577c6 |
@@ -64,16 +64,16 @@ def getUpcomingMeals():
|
|||||||
meals.append(dict(row))
|
meals.append(dict(row))
|
||||||
seconds_to_deadline = (meals[-1]['selection_deadline'] - datetime.datetime.now()).total_seconds()
|
seconds_to_deadline = (meals[-1]['selection_deadline'] - datetime.datetime.now()).total_seconds()
|
||||||
if seconds_to_deadline < 0:
|
if seconds_to_deadline < 0:
|
||||||
meals[-1]['selection_deadline'] = 'Deadline passed'
|
meals[-1]['friendly_selection_deadline'] = ''
|
||||||
elif seconds_to_deadline > 3600:
|
elif seconds_to_deadline > 3600:
|
||||||
hours_td = round(seconds_to_deadline / 3600)
|
hours_td = round(seconds_to_deadline / 3600)
|
||||||
days_td = int(hours_td / 24)
|
days_td = int(hours_td / 24)
|
||||||
hours_td = hours_td % 24
|
hours_td = hours_td % 24
|
||||||
meals[-1]['selection_deadline'] = str(days_td) + ' days ' + str(hours_td) + ' hours'
|
meals[-1]['friendly_selection_deadline'] = str(days_td) + ' days ' + str(hours_td) + ' hours'
|
||||||
else:
|
else:
|
||||||
meals[-1]['selection_deadline'] = str(round(seconds_to_deadline / 60)) + ' minutes'
|
meals[-1]['friendly_selection_deadline'] = str(round(seconds_to_deadline / 60)) + ' minutes'
|
||||||
meals[-1]['meal_time'] = meals[-1]['meal_date'].strftime('%H:%M')
|
meals[-1]['meal_time'] = meals[-1]['meal_date'].strftime('%H:%M')
|
||||||
meals[-1]['meal_date'] = meals[-1]['meal_date'].strftime('%A %d %B')
|
meals[-1]['meal_friendly_date'] = meals[-1]['meal_date'].strftime('%A %d %B')
|
||||||
meals[-1]['candidate'] = 'davide'
|
meals[-1]['candidate'] = 'davide'
|
||||||
r.close()
|
r.close()
|
||||||
return meals
|
return meals
|
||||||
|
|||||||
@@ -33,15 +33,15 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="right-pane">
|
<div class="right-pane">
|
||||||
<div class="meal-list">
|
<div class="meal-list">
|
||||||
<h2>{{meals[0].meal_date}}</h2>
|
<h2>{{meals[0].meal_friendly_date}}</h2>
|
||||||
{% for meal in meals %}
|
{% for meal in meals %}
|
||||||
{% if loop.index != 1 and (meal.meal_date != meals[loop.index - 2].meal_date) %}
|
{% if loop.index != 1 and (meal.meal_friendly_date != meals[loop.index - 2].meal_friendly_date) %}
|
||||||
<h2>{{meal.meal_date}}</h2>
|
<h2>{{meal.meal_friendly_date}}</h2>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<div class="flex-card" onclick="location.href='/meal/{{meal.id}}';" style="cursor: pointer; width: 60%; justify-content: space-between;">
|
<div class="flex-card" onclick="location.href='/meal/{{meal.id}}';" style="cursor: pointer; width: 60%; justify-content: space-between;">
|
||||||
<span><b>{{meal.meal_time}}</b></span>
|
<span><b>{{meal.meal_time}}</b></span>
|
||||||
<p style="text-align: left;">{% if meal.kuk != "" %}<img class="flex-small-thumb" src="{{url_for('static', filename=meal.kuk + '.png')}}" title="{{meal.kuk}}" align="middle" style="margin: " /> <b>WILL</b>{% else %}<img class="flex-small-thumb" src="{{url_for('static', filename=meal.candidate + '.png')}}" title="{{meal.kuk}}" align="middle" style="margin: " /> <b>SHOULD</b>{% endif%} cook for <br>{% for e in meal.eaters %}<img class="flex-small-thumb" src="{{url_for('static', filename=e + '.png')}}" title="{{e}}" align="middle"/> {% endfor %}</p>
|
<p style="text-align: left;">{% if meal.kuk != "" %}<img class="flex-small-thumb" src="{{url_for('static', filename=meal.kuk + '.png')}}" title="{{meal.kuk}}" align="middle" style="margin: " /> <b>WILL</b>{% else %}<img class="flex-small-thumb" src="{{url_for('static', filename=meal.candidate + '.png')}}" title="{{meal.kuk}}" align="middle" style="margin: " /> <b>SHOULD</b>{% endif%} cook for <br>{% for e in meal.eaters %}<img class="flex-small-thumb" src="{{url_for('static', filename=e + '.png')}}" title="{{e}}" align="middle"/> {% endfor %}</p>
|
||||||
<span>{% if meal.selection_deadline != 'Deadline passed' %}Confirmed in {% endif %}{{meal.selection_deadline}}</span>
|
<span>{% if meal.friendly_selection_deadline != '' %}Confirmed in {{meal.friendly_selection_deadline}}{% else %}Confirmed.{% endif %}</span>
|
||||||
</div>
|
</div>
|
||||||
{% endfor%}
|
{% endfor%}
|
||||||
<h2> </h2>
|
<h2> </h2>
|
||||||
|
|||||||
Reference in New Issue
Block a user