mirror of
https://github.com/nottinghamtec/PyRIGS.git
synced 2026-01-17 05:22:16 +00:00
Fix various minor issues (#545)
* Add absolute URL to power tests * Update to target Python 3.10 * Return user to current page when clicking 'mark reviewed' * Add units to power test record detail and form I'm a bad scientist (coz I'm an engineer) * Allow a higher value in PSSC fields * Default venue to event venue in EC/PT * Fix population of initial venue values for EC/PT * Add link to create power test from EC detail * Do not set power plan field to required on RA "This might be a problem if the risk assessment is being done by one person and the power plan by another." * Default power MIC to MIC * Implement some suggestions from the Doctor * Prevent checking in to cancelled events and dry hires Will close #539 * Exclude dry hires from H&S overview list * Add "ex VAT" tooltips to asset purchase price and replacement cost * Automagically clear and focus ID field when audit modal closes Closes #533 * Delete unused things * Allow two decimal places in cable length, show training item IDs in selectpicker Will close #540 * Fix #524 500 Error when viewing qualification list for items nobody is qualified in * Update README.md * Add a guard against nulls in recent changes Maybe fixes #537 I'm unable to replicate locally * Turn down verbosity of CI tests, fix tests, potential speedup * Squash migration * Add encoding to open * Update to v3 upload-artifact Resolves a deprecation warning
This commit is contained in:
@@ -105,6 +105,10 @@ class TrainingItem(models.Model):
|
||||
def display_id(self):
|
||||
return f"{self.category.reference_number}.{self.reference_number}"
|
||||
|
||||
@property
|
||||
def display_name(self):
|
||||
return f"{self.display_id} | {self.name}"
|
||||
|
||||
@display_id.filter
|
||||
@classmethod
|
||||
def display_id(cls, lookup, value):
|
||||
@@ -369,7 +373,7 @@ class TrainingLevelQualification(models.Model, RevisionMixin):
|
||||
return str(self)
|
||||
|
||||
def get_absolute_url(self):
|
||||
return reverse('trainee_detail', kwargs={'pk': self.trainee.pk})
|
||||
return reverse('trainee_detail', kwargs={'pk': self.trainee_id})
|
||||
|
||||
class Meta:
|
||||
unique_together = ["trainee", "level"]
|
||||
|
||||
@@ -43,7 +43,7 @@ def confirm_button(user, trainee, level):
|
||||
if level.user_has_requirements(trainee):
|
||||
string = "<span class='badge badge-warning p-2'>Awaiting Confirmation</span>"
|
||||
if models.Trainee.objects.get(pk=user.pk).is_supervisor or user.has_perm('training.add_traininglevelqualification'):
|
||||
string += "<a class='btn btn-info' href='{}'>Confirm</a>".format(reverse('confirm_level', kwargs={'pk': trainee.pk, 'level_pk': level.pk}))
|
||||
string += f"<a class='btn btn-info' href='{reverse('confirm_level', kwargs={'pk': trainee.pk, 'level_pk': level.pk})}'>Confirm</a>"
|
||||
return mark_safe(string)
|
||||
else:
|
||||
return ""
|
||||
|
||||
@@ -44,7 +44,7 @@ def test_add_qualification(logged_in_browser, live_server, trainee, supervisor,
|
||||
page.submit()
|
||||
assert page.success
|
||||
qualification = models.TrainingItemQualification.objects.get(trainee=trainee, item=training_item)
|
||||
assert qualification.supervisor.pk == supervisor.pk
|
||||
assert qualification.supervisor_id == supervisor.pk
|
||||
assert qualification.date == date
|
||||
assert qualification.notes == "A note"
|
||||
assert qualification.depth == models.TrainingItemQualification.STARTED
|
||||
|
||||
@@ -29,7 +29,7 @@ def test_add_qualification_reversion(admin_client, trainee, training_item, super
|
||||
assert response.status_code == 302
|
||||
qual = models.TrainingItemQualification.objects.last()
|
||||
assert qual is not None
|
||||
assert training_item.pk == qual.item.pk
|
||||
assert training_item.pk == qual.item_id
|
||||
# Ensure only one revision has been created
|
||||
assert Revision.objects.count() == 1
|
||||
response = admin_client.post(url, {'date': date, 'supervisor': supervisor.pk, 'trainee': trainee.pk, 'item': training_item.pk, 'depth': 1})
|
||||
|
||||
@@ -265,5 +265,5 @@ class ItemQualifications(generic.ListView):
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super().get_context_data(**kwargs)
|
||||
context["page_title"] = f"People Qualified In {self.object_list[0].item}"
|
||||
context["page_title"] = f"People Qualified In {models.TrainingItem.objects.get(pk=self.kwargs['pk'])}"
|
||||
return context
|
||||
|
||||
Reference in New Issue
Block a user