-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
37 changed files
with
1,409 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
""" Form for statistics display and parameters """ | ||
|
||
from datetime import date | ||
|
||
from wtforms import SelectField, SubmitField | ||
|
||
from collectives.forms.activity_type import ActivityTypeSelectionForm | ||
|
||
|
||
class StatisticsParametersForm(ActivityTypeSelectionForm): | ||
"""Parameters for statistics page""" | ||
|
||
year = SelectField() | ||
""" Year to display """ | ||
|
||
submit = SubmitField(label="Sélectionner") | ||
""" Submit button for regular HTML display """ | ||
|
||
excel = SubmitField(label="Export Excel") | ||
""" Submit button for excel download """ | ||
|
||
def __init__(self, *args, **kwargs): | ||
"""Creates a new form""" | ||
current_year = date.today().year - 2000 | ||
if date.today().month < 9: | ||
current_year = current_year - 1 | ||
|
||
super().__init__(year=2000 + current_year, *args, **kwargs) | ||
self.activity_id.choices = [(9999, "Toute activité")] + self.activity_id.choices | ||
current_year = date.today().year - 2000 | ||
self.year.choices = [ | ||
(2000 + year, f"Année 20{year}/{year+1}") | ||
for year in range(20, current_year) | ||
] | ||
|
||
class Meta: | ||
"""Form meta parameters""" | ||
|
||
csrf = False | ||
""" CSRF parameter. | ||
It is deactivated for this form""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,3 +17,4 @@ | |
@import 'card'; | ||
@import 'usericon'; | ||
@import 'technician-configuration'; | ||
@import 'stats'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
.card { | ||
position: relative; | ||
border-radius: 6px; | ||
box-shadow: 0 .5em 1em -.125em rgba(10,10,10,.1),0 0 0 1px rgba(10,10,10,.02); | ||
color: #4a4a4a; | ||
display: block; | ||
padding: 1.25rem; | ||
border: 0.5px solid #e6e6e6; | ||
|
||
.tooltip{ | ||
position: absolute; | ||
bottom: 5px; | ||
right: 10px; | ||
|
||
.text { | ||
visibility: hidden; | ||
min-width: 300px; | ||
background-color: rgb(51, 51, 51); | ||
color: #fff; | ||
text-align: justify; | ||
padding: 10px; | ||
border-radius: 6px; | ||
position: absolute; | ||
z-index: 1; | ||
right: 105%; | ||
} | ||
|
||
img{ | ||
height: 1.5em; | ||
width: 1.5em; | ||
opacity: 0.75; | ||
} | ||
} | ||
.tooltip:hover .text, .tooltip:active .text { | ||
visibility: visible; | ||
} | ||
} | ||
|
||
.card.single-stat{ | ||
text-align: center; | ||
|
||
.value{ | ||
font-size: 4em; | ||
font-weight: bold; | ||
} | ||
|
||
.header-3{ | ||
font-weight: normal; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
collectives/templates/stats/partials/mean_collectives_per_day.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<div class="heading-3">{{ engine.INDEX['mean_collectives_per_day']['name'] }}</div> | ||
<div class="value">{% if engine.mean_collectives_per_day() %}{{engine.mean_collectives_per_day() | round(2)}}{%else%}-{% endif %}</div> | ||
<div class="tooltip"> | ||
<img src="{{ url_for('static', filename='img/icon/ionicon/md-information-circle-outline.svg') }}" alt="(I)" /> | ||
<span class="text">{{ engine.INDEX['mean_collectives_per_day']['description'] }}</span> | ||
</div> |
6 changes: 6 additions & 0 deletions
6
collectives/templates/stats/partials/mean_events_per_day.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<div class="heading-3">{{ engine.INDEX['mean_events_per_day']['name'] }}</div> | ||
<div class="value">{% if engine.mean_events_per_day() %}{{engine.mean_events_per_day() | round(2)}}{%else%}-{% endif %}</div> | ||
<div class="tooltip"> | ||
<img src="{{ url_for('static', filename='img/icon/ionicon/md-information-circle-outline.svg') }}" alt="(I)" /> | ||
<span class="text">{{ engine.INDEX['mean_events_per_day']['description'] }}</span> | ||
</div> |
6 changes: 6 additions & 0 deletions
6
collectives/templates/stats/partials/mean_registrations_per_day.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<div class="heading-3">{{ engine.INDEX['mean_registrations_per_day']['name'] }}</div> | ||
<div class="value">{% if engine.mean_registrations_per_day() %}{{engine.mean_registrations_per_day() | round(2)}}{%else%}-{% endif %}</div> | ||
<div class="tooltip"> | ||
<img src="{{ url_for('static', filename='img/icon/ionicon/md-information-circle-outline.svg') }}" alt="(I)" /> | ||
<span class="text">{{ engine.INDEX['mean_registrations_per_day']['description'] }}</span> | ||
</div> |
6 changes: 6 additions & 0 deletions
6
collectives/templates/stats/partials/mean_registrations_per_event.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<div class="heading-3">{{ engine.INDEX['mean_registrations_per_event']['name'] }}</div> | ||
<div class="value">{{engine.mean_registrations_per_event() | round(2)}}</div> | ||
<div class="tooltip"> | ||
<img src="{{ url_for('static', filename='img/icon/ionicon/md-information-circle-outline.svg') }}" alt="(I)" /> | ||
<span class="text">{{ engine.INDEX['mean_registrations_per_event']['description'] }}</span> | ||
</div> |
7 changes: 7 additions & 0 deletions
7
collectives/templates/stats/partials/nb_active_registrations.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
|
||
<div class="heading-3">{{ engine.INDEX['nb_active_registrations']['name'] }}</div> | ||
<div class="value">{{engine.nb_active_registrations()}}</div> | ||
<div class="tooltip"> | ||
<img src="{{ url_for('static', filename='img/icon/ionicon/md-information-circle-outline.svg') }}" alt="(I)" /> | ||
<span class="text">{{ engine.INDEX['nb_active_registrations']['description'] }}</span> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<div class="heading-3">Nombre d'évènements</div> | ||
<div class="value">{{engine.nb_collectives()}}</div> | ||
<div class="tooltip"> | ||
<img src="{{ url_for('static', filename='img/icon/ionicon/md-information-circle-outline.svg') }}" alt="(I)" /> | ||
<span class="text">{{ engine.INDEX['nb_collectives']['description'] }}</span> | ||
</div> |
26 changes: 26 additions & 0 deletions
26
collectives/templates/stats/partials/nb_collectives_by_activity_type.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<canvas id="collectives-activity-chart"></canvas> | ||
|
||
<div class="tooltip"> | ||
<img src="{{ url_for('static', filename='img/icon/ionicon/md-information-circle-outline.svg') }}" alt="(I)" /> | ||
<span class="text">{{ engine.INDEX['nb_collectives_by_activity_type']['description'] }}</span> | ||
</div> | ||
|
||
<script> | ||
new Chart(document.getElementById('collectives-activity-chart'), { | ||
type: 'bar', | ||
data: { | ||
labels: {{ engine.nb_collectives_by_activity_type().keys() | list | tojson | safe }}, | ||
datasets: [{ | ||
data: {{ engine.nb_collectives_by_activity_type().values() | list | tojson|safe }}, | ||
}] | ||
}, | ||
options: { | ||
aspectRatio: 3, | ||
plugins: { | ||
title: { | ||
text: "{{ engine.INDEX['nb_collectives_by_activity_type']['name'] | safe }}", | ||
} | ||
}, scales: {y:{grace:"15%"}} | ||
} | ||
}); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<div class="heading-3">Nombre d'évènements</div> | ||
<div class="value">{{engine.nb_events()}}</div> | ||
<div class="tooltip"> | ||
<img src="{{ url_for('static', filename='img/icon/ionicon/md-information-circle-outline.svg') }}" alt="(I)" /> | ||
<span class="text">{{ engine.INDEX['nb_events']['description'] }}</span> | ||
</div> |
26 changes: 26 additions & 0 deletions
26
collectives/templates/stats/partials/nb_events_by_activity_type.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<canvas id="activity-chart"></canvas> | ||
|
||
<div class="tooltip"> | ||
<img src="{{ url_for('static', filename='img/icon/ionicon/md-information-circle-outline.svg') }}" alt="(I)" /> | ||
<span class="text">{{ engine.INDEX['nb_events_by_activity_type']['description'] }}</span> | ||
</div> | ||
|
||
<script> | ||
new Chart(document.getElementById('activity-chart'), { | ||
type: 'bar', | ||
data: { | ||
labels: {{ engine.nb_events_by_activity_type().keys() | list | tojson | safe }}, | ||
datasets: [{ | ||
data: {{ engine.nb_events_by_activity_type().values() | list | tojson|safe }}, | ||
}] | ||
}, | ||
options: { | ||
aspectRatio: 3, | ||
plugins: { | ||
title: { | ||
text: "{{ engine.INDEX['nb_events_by_activity_type']['name'] | safe }}", | ||
} | ||
}, scales: {y:{grace:"15%"}} | ||
} | ||
}); | ||
</script> |
Oops, something went wrong.