diff --git a/aircox/models.py b/aircox/models.py index b9497a6..8f3ff16 100755 --- a/aircox/models.py +++ b/aircox/models.py @@ -208,6 +208,8 @@ class Station(Nameable): logs.filter(date__gt = diff.end, date__lt = diff_.start) \ if diff_ else \ logs.filter(date__gt = diff.end) + print(diff.end, *[str(log.date > diff.end) + " " + str(log.date) for log in logs]) + diff_ = diff items.extend(logs_) items.append(diff) @@ -217,7 +219,7 @@ class Station(Nameable): if diff_: if count and len(items) >= count: return items[:count] - logs_ = logs.filter(date__lt = diff_.end) + logs_ = logs.filter(date__lt = diff_.start) else: logs_ = logs.all() diff --git a/aircox/static/aircox/css/layout.css b/aircox/static/aircox/css/layout.css new file mode 100644 index 0000000..6f0d0bb --- /dev/null +++ b/aircox/static/aircox/css/layout.css @@ -0,0 +1,58 @@ + +body { + background-color: #373737; + background-color: #F2F2F2; + font-family: 'Myriad Pro', Calibri, Helvetica, Arial, sans-serif; + font-size: 18px; + line-height: 1.5; +} + +main { + padding: 1em; +} + + +input { + padding: 0.4em; +} + + +table { + background-color: #f2f2f2; + border: 1px black solid; + width: 80%; + margin: auto; +} + +td { + margin: 0; + padding: 0 0.4em; +} + +th { + text-align: left; + font-weight: normal; + margin: 0; + padding: 0.4em; +} + +tr:not(.header):hover { + background-color: rgba(0, 0, 0, 0.1); +} + +tr.header { + background-color: #212121; + color: #eee; +} + +tr.bottom > td { + vertical-align: top; + padding: 0.4em; +} + +tr.subdata { + font-style: italic; + font-size: 0.9em; +} + + diff --git a/aircox/templates/aircox/controllers/base_site.html b/aircox/templates/aircox/controllers/base_site.html new file mode 100644 index 0000000..e844cde --- /dev/null +++ b/aircox/templates/aircox/controllers/base_site.html @@ -0,0 +1,27 @@ +{% load static %} + + +
+{% trans "Date" %} | +{% trans "Type" %} {# Translators "Header for statistics view" #} - | {% trans "Diffusion or sound played" %} - | + | {% trans "Diffusion or sound played" %} + | {% trans "Tags" %} |
---|---|---|---|---|---|
{{ item.date|date:"H:i" }} | +|||||
{{ item.date|time:"H:i" }} | +{{ item.type }} | {{ item.name }} | {% for tag,count in item.tags.items %} {{ tag }}: {{ count }}; {% endfor %} | -{{ item.type }} | |
{{ track.date|date:"H:i" }} | +|||||
{{ track.date|time:"H:i" }} | +{% trans "Track" %} | {{ track.artist }} -- |
{{ track.tags.all|join:', ' }} | ||
{{ stats.date|date:'d/m/Y' }} | +{% trans "Total" %} | {# TODO: translation block #} -{% trans "Total and average" %} ({{ stats.count }} tracks) | ++ {% with stats.items|length as items_count %} + {% with stats.count as tracks_count %} + {% blocktrans %} + {{ items_count }} items, with a total of {{ tracks_count }} tracks + {% endblocktrans %} + {% endwith %} + {% endwith %} + | {% for tag, count, average in stats.tags %}
- {{ tag }}: {{ count }} / {{ average|floatformat }}%;
+ {{ tag }}: {{ average|floatformat }}% ({{ count }}) {% endfor %} |