mirror of
https://github.com/nottinghamtec/PyRIGS.git
synced 2026-01-18 14:02:15 +00:00
Fix is_supervisor returning true if user has any levels
Whoops!
This commit is contained in:
@@ -19,7 +19,7 @@ class Trainee(Profile, RevisionMixin):
|
||||
@property
|
||||
def is_supervisor(self):
|
||||
return self.level_qualifications.all().exclude(confirmed_on=None).select_related('level') \
|
||||
.filter(level__gte=TrainingLevel.SUPERVISOR) \
|
||||
.filter(level__level__gte=TrainingLevel.SUPERVISOR) \
|
||||
.exclude(level__department=TrainingLevel.HAULAGE) \
|
||||
.exclude(level__department__isnull=True).exists()
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
<td {% if object.is_driver %}class="table-success"{%endif%}>{{ object.is_driver|yesno|title }}</td>
|
||||
<td>{% for level in object|get_levels_of_depth:1 %}{% if forloop.first %}Yes {%endif%}{{ level.get_icon }}{%empty%}No{%endfor%}</td>
|
||||
<td {% if object.is_supervisor %}class="table-success"{%endif%}>{% for level in object|get_levels_of_depth:2 %}{% if forloop.first %}Yes {%endif%}{{ level.get_icon }}{%empty%}No{%endfor%}</td>
|
||||
<td>{{ object.num_qualifications }}</td>
|
||||
<td>{{ object.num_qualifications }} {% if forloop.first %} <span class="fas fa-crown text-warning"></span>{% endif %}</td>
|
||||
<td style="white-space: nowrap">
|
||||
<a class="btn btn-info" href="{% url 'trainee_detail' pk=object.pk %}"><span class="fas fa-eye"></span> View Training Record</a>
|
||||
<a href="{% url 'trainee_item_detail' pk=object.pk %}" class="btn btn-info"><span class="fas fa-info-circle"></span> View Detailed Record</a>
|
||||
|
||||
@@ -39,4 +39,4 @@ def get_supervisor(tech):
|
||||
|
||||
@register.filter
|
||||
def get_levels_of_depth(trainee, level):
|
||||
return trainee.level_qualifications.all().exclude(confirmed_on=None).select_related('level').filter(level__level=level)
|
||||
return trainee.level_qualifications.all().exclude(confirmed_on=None).exclude(level__department=models.TrainingLevel.HAULAGE).select_related('level').filter(level__level=level)
|
||||
|
||||
Reference in New Issue
Block a user