Improve note management

This commit is contained in:
Gregory Trullemans 2022-10-07 09:31:56 +02:00
parent 151ccca964
commit c87ed79871
5 changed files with 16 additions and 11 deletions

View File

@ -74,12 +74,10 @@
{% menuitem 'home' 'fal fa-chart-pie' 'Dashboard' %}
{% menuitem 'gymnast_list' 'tim-icons icon-badge' 'Gymnasts' %}
{% menuitem 'skill_list' 'tim-icons icon-molecule-40' 'Skills' %}
{% menuitem 'routine_list' 'tim-icons icon-components' 'Routine' %}
<!-- {% menuitem 'event_list' 'tim-icons icon-calendar-60' 'Events' %} -->
{% menuitem 'routine_list' 'tim-icons icon-components' 'Routines' %}
{% menuitem 'event_list' 'fal fa-calendar-alt' 'Events' %}
{% menuitem 'accident_list' 'fal fa-comment-alt-medical' 'Accidents' %}
<!-- {% menuitem 'club_list' 'tim-icons icon-square-pin' 'Clubs' %} -->
<!-- {% menuitem 'place_list' 'tim-icons icon-square-pin' 'Places' %} -->
{% menuitem 'place_list' 'fal fa-map-marked-alt' 'Places' %}
{% menuitem 'chrono_list' 'fal fa-stopwatch' 'Chronos' %}
{% if request.user.is_staff %}

View File

@ -1,6 +1,6 @@
{% load has_group %}
{% if latest_note %}
{% if latest_published_note %}
<div class="row justify-content-center ml-1">
<div class="col-md-12">
<div class="card">
@ -8,7 +8,7 @@
<h4>Latest note</h4>
</div>
<div class="card-body pt-0">
<p>{{ latest_note.to_markdown | safe }}</p>
<p>{{ latest_published_note.to_markdown | safe }}</p>
</div>
</div>
</div>
@ -83,6 +83,7 @@
<a href="{% url 'note_update' note.id %}">
<span class="tim-icons icon-pencil text-warning"></span>
</a>
&nbsp;&nbsp;{% if not note.status %}<i class="fas fa-exclamation-triangle text-danger"></i>{% endif %}
</td>
<td class="text-left">
<a href="{% url 'note_details' note.id %}">{{ note.created_at | date:"d-m-Y" }}</a>

View File

@ -11,8 +11,8 @@
<h4 class=""><i class="icon-primary fal fa-laugh-wink"></i> Hi {{ user.username }} !</h4>
</div>
<div class="card-body">
Welcome to Ultron v0.52 <span class="text-muted">(last update : 30-9-2022)</span><br />
This application is here to help us to manage the gymnasts (evolution, evaluation, routines, scores, ...). This tool is not perfect so feel free to make improvement proposals, bug reports, … by sending me an <a href="mailto:gregory@flyingacrobaticstrampoline.be">email</a>.<br/>
Welcome to Ultron v0.55 <span class="text-muted">(last update : 7-10-2022)</span><br />
This application is here to help us to manage the gymnasts (evolution, evaluation, routines, scores, ). This tool is not perfect so feel free to make improvement proposals, bug reports, … by sending me an <a href="mailto:gregory@flyingacrobaticstrampoline.be">email</a>.<br/>
<br/>
</div>
</div>

View File

@ -235,15 +235,21 @@ def gymnast_display_events_and_notes(request, gymnast_id):
gymnasts=gymnast_id, date_begin__lte=today
)
notes_list = Note.objects.filter(gymnast=gymnast_id).order_by('-created_at')[:5]
base_queryset = Note.objects.filter(gymnast=gymnast_id)
if not request.user.groups.filter(name='trainer').exists():
notes_list = base_queryset.filter(status=1)
else:
notes_list = base_queryset
notes_list = notes_list.order_by('-created_at')
last_notes_list = notes_list[:5]
latest_note = notes_list.first()
latest_published_note = base_queryset.filter(status=1).order_by('-created_at').first()
context = {
"next_event_list": next_event_list,
"previous_event_list": previous_event_list,
"last_notes_list": last_notes_list,
"latest_note": latest_note,
"latest_published_note": latest_published_note,
"gymnast_id": gymnast_id,
}
return render(request, "people/gymnasts/tab_events_and_notes.html", context)

View File

@ -615,7 +615,7 @@ class GymnastReportDocument(PDFDocument):
if today.weekday() != 0:
begin_of_the_week -= timedelta(today.weekday())
notes = gymnast.remarks.filter(created_at__gte=begin_of_the_week)
notes = gymnast.remarks.filter(created_at__gte=begin_of_the_week).filter(status=1)
if notes:
html_text = ''