mirror of
https://github.com/nottinghamtec/PyRIGS.git
synced 2026-01-17 21:42:14 +00:00
mild polishing
This commit is contained in:
@@ -20,6 +20,7 @@ class Command(BaseCommand):
|
||||
assets = []
|
||||
|
||||
def handle(self, *args, **kwargs):
|
||||
print("Generating sample assets data")
|
||||
from django.conf import settings
|
||||
|
||||
if not (settings.DEBUG or settings.STAGING):
|
||||
@@ -34,6 +35,7 @@ class Command(BaseCommand):
|
||||
self.create_assets()
|
||||
self.create_connectors()
|
||||
self.create_cables()
|
||||
print("Done generating sample assets data")
|
||||
|
||||
def create_categories(self):
|
||||
choices = ['Case', 'Video', 'General', 'Sound', 'Lighting', 'Rigging']
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
<img src="{% static 'imgs/logo.webp' %}" width="40" height="40" alt="TEC's Logo: Serif 'TEC' vertically next to a blue box with the words 'PA and Lighting', surrounded by graduated rings" id="logo">
|
||||
</a>
|
||||
<div class="container" style="padding-left: 0; padding-right: 0;">
|
||||
<div class="row w-100">
|
||||
<div class="row w-100 flex-nowrap">
|
||||
{% block titleheader %}
|
||||
{% endblock %}
|
||||
<button class="navbar-toggler ml-auto" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation" onclick="document.getElementById('logo').classList.toggle('d-none');">
|
||||
|
||||
@@ -19,7 +19,7 @@ class Command(BaseCommand):
|
||||
levels = []
|
||||
|
||||
def handle(self, *args, **options):
|
||||
print("Generating Training Data")
|
||||
print("Generating training data")
|
||||
from django.conf import settings
|
||||
|
||||
if not (settings.DEBUG or settings.STAGING):
|
||||
@@ -31,6 +31,7 @@ class Command(BaseCommand):
|
||||
self.setup_categories()
|
||||
self.setup_items()
|
||||
self.setup_levels()
|
||||
print("Done generating training data")
|
||||
|
||||
def setup_categories(self):
|
||||
names = [(1, "Basic"), (2, "Sound"), (3, "Lighting"), (4, "Rigging"), (5, "Power"), (6, "Haulage")]
|
||||
@@ -53,5 +54,10 @@ class Command(BaseCommand):
|
||||
technician = models.TrainingLevel.objects.create(level=models.TrainingLevel.TECHNICIAN, department=i, description="Moral pinnacle derive ultimate war dead. Strong fearful joy contradict battle christian faithful enlightenment prejudice zarathustra moral.")
|
||||
supervisor = models.TrainingLevel.objects.create(level=models.TrainingLevel.SUPERVISOR, department=i, description="Spirit holiest merciful mountains inexpedient reason value. Suicide ultimate hope.")
|
||||
supervisor.prerequisite_levels.add(technician)
|
||||
for i in range(0, 30):
|
||||
if i % 3 == 0:
|
||||
models.TrainingLevelRequirement.objects.create(level=technician, item=random.choice(self.items), depth=random.choice(models.TrainingItemQualification.CHOICES)[0])
|
||||
else:
|
||||
models.TrainingLevelRequirement.objects.create(level=supervisor, item=random.choice(self.items), depth=random.choice(models.TrainingItemQualification.CHOICES)[0])
|
||||
self.levels.append(technician)
|
||||
self.levels.append(supervisor)
|
||||
|
||||
@@ -71,8 +71,23 @@ class TrainingLevel(models.Model, RevisionMixin):
|
||||
level = models.IntegerField(choices=CHOICES)
|
||||
prerequisite_levels = models.ManyToManyField('self', related_name='prerequisites', symmetrical=False, blank=True)
|
||||
|
||||
def get_requirements_of_depth(self, depth):
|
||||
return self.requirements.filter(depth=depth)
|
||||
|
||||
@property
|
||||
def started_requirements(self):
|
||||
return self.get_requirements_of_depth(TrainingItemQualification.STARTED)
|
||||
|
||||
@property
|
||||
def complete_requirements(self):
|
||||
return self.get_requirements_of_depth(TrainingItemQualification.COMPLETE)
|
||||
|
||||
@property
|
||||
def passed_out_requirements(self):
|
||||
return self.get_requirements_of_depth(TrainingItemQualification.PASSED_OUT)
|
||||
|
||||
def __str__(self):
|
||||
if self.department is None: # TA
|
||||
if self.department is None: # 2TA
|
||||
return self.get_level_display()
|
||||
else:
|
||||
return "{} {}".format(self.get_department_display(), self.get_level_display())
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{% extends 'base_rigs.html' %}
|
||||
|
||||
{% block content %}
|
||||
<div class="row my-3 align-items-end">
|
||||
<div class="row my-3 text-right">
|
||||
<a type="button" class="btn btn-success" href="{% url 'edit_record' pk=request.user.pk %}">
|
||||
<i class="fas fa-plus"></i> Add New Training Record
|
||||
</a>
|
||||
@@ -17,19 +17,30 @@
|
||||
<div class="progress-bar progress-bar-striped" role="progressbar" style="width: 25%" aria-valuenow="25" aria-valuemin="0" aria-valuemax="100">25% complete</div>
|
||||
</div>
|
||||
<p>{{ level.description }}</p>
|
||||
<p>Requirements:
|
||||
<button class="btn btn-link" type="button" data-toggle="collapse" data-target="#reqs" aria-expanded="false" aria-controls="reqs">
|
||||
<span class="fas fa-arrow-down"></span>
|
||||
<button class="btn btn-link p-0" type="button" data-toggle="collapse" data-target=".reqs_{{level.pk}}" aria-expanded="false" aria-controls="reqs">
|
||||
Requirements <span class="fas fa-caret-right reqs_{{level.pk}} collapse show"></span><span class="fas fa-caret-down collapse reqs_{{level.pk}}"></span>
|
||||
</button>
|
||||
<div class="collapse" id="reqs">
|
||||
{% for req in level.requirements.all %}
|
||||
<li>{{req}}</li>
|
||||
{% endfor %}
|
||||
</p>
|
||||
<div class="collapse reqs_{{level.pk}}">
|
||||
<table class="table table-sm">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col" class="table-warning">Training Started</th>
|
||||
<th scope="col" class="table-success">Training Complete</th>
|
||||
<th scope="col" class="table-info">Passed Out</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><ul class="list-unstyled">{% for req in level.started_requirements %}<li>{{ req.item }}</li>{% endfor %}</ul></td>
|
||||
<td><ul class="list-unstyled">{% for req in level.complete_requirements %}<li>{{ req.item }}</li>{% endfor %}</ul></td>
|
||||
<td><ul class="list-unstyled">{% for req in level.passed_out_requirements %}<li>{{ req.item }}</li>{% endfor %}</ul></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-footer">
|
||||
<button class="btn btn-success" disabled>Incomplete</button>
|
||||
<button class="btn btn-success text-right" disabled>Incomplete</button>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
||||
Reference in New Issue
Block a user