Hide button if no last session

This commit is contained in:
Lukáš Kucharczyk 2023-01-15 13:02:02 +01:00
parent 64f5668dde
commit 163211ab0b
3 changed files with 5 additions and 1 deletions

View File

@ -6,7 +6,7 @@ RUN npm install && \
FROM python:3.10.9-alpine FROM python:3.10.9-alpine
ENV VERSION_NUMBER 0.2.1 ENV VERSION_NUMBER 0.2.1-2-g734e6de
ENV PROD 1 ENV PROD 1
RUN apk add \ RUN apk add \

View File

@ -11,6 +11,8 @@ python = "^3.10"
django = "^4.1.4" django = "^4.1.4"
gunicorn = "^20.1.0" gunicorn = "^20.1.0"
uvicorn = "^0.20.0" uvicorn = "^0.20.0"
pandas = "^1.5.2"
matplotlib = "^3.6.3"
[tool.poetry.group.dev.dependencies] [tool.poetry.group.dev.dependencies]
black = "^22.12.0" black = "^22.12.0"

View File

@ -4,11 +4,13 @@
{% block content %} {% block content %}
<div class="text-center text-xl mb-4 dark:text-slate-400"> <div class="text-center text-xl mb-4 dark:text-slate-400">
{% if dataset.count > 0 %}
<a href="{% url 'start_session' dataset.last.purchase.id %}"> <a href="{% url 'start_session' dataset.last.purchase.id %}">
<button type="button" title="Track last tracked" class="py-1 px-2 bg-green-600 hover:bg-green-700 focus:ring-green-500 focus:ring-offset-blue-200 text-white transition ease-in duration-200 text-center text-base font-semibold shadow-md focus:outline-none focus:ring-2 focus:ring-offset-2 rounded-lg "> <button type="button" title="Track last tracked" class="py-1 px-2 bg-green-600 hover:bg-green-700 focus:ring-green-500 focus:ring-offset-blue-200 text-white transition ease-in duration-200 text-center text-base font-semibold shadow-md focus:outline-none focus:ring-2 focus:ring-offset-2 rounded-lg ">
New session of {{ dataset.last.purchase }} New session of {{ dataset.last.purchase }}
</button> </button>
</a> </a>
{% endif %}
{% if purchase %} {% if purchase %}
<h1>Listing sessions only for purchase "{{ purchase }}"</h1> <h1>Listing sessions only for purchase "{{ purchase }}"</h1>
<h2>Total playtime: {{ total_duration }} over {{ dataset.count }} sessions.</h2> <h2>Total playtime: {{ total_duration }} over {{ dataset.count }} sessions.</h2>