Compare commits
7 Commits
fcff722260
...
imgbot
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d5dc879733 | ||
|
c537118037
|
|||
|
466a9a9693
|
|||
| d25381b2de | |||
|
|
eaf891daf7 | ||
|
|
801d2e8a7d | ||
|
|
3d329219b8 |
@@ -1,25 +0,0 @@
|
|||||||
# Generated by Django 3.2.11 on 2022-01-09 15:00
|
|
||||||
|
|
||||||
from django.db import migrations
|
|
||||||
|
|
||||||
from training.models import TrainingLevel
|
|
||||||
|
|
||||||
def find_existing_supervisors(apps, schema_editor):
|
|
||||||
Profile = apps.get_model('RIGS', 'Profile')
|
|
||||||
for person in Profile.objects.all():
|
|
||||||
if person.level_qualifications.exclude(confirmed_on=None).select_related('level') \
|
|
||||||
.filter(level__level__gte=TrainingLevel.SUPERVISOR) \
|
|
||||||
.exclude(level__department=TrainingLevel.HAULAGE) \
|
|
||||||
.exclude(level__department__isnull=True).exists():
|
|
||||||
person.is_supervisor = True
|
|
||||||
person.save()
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
('RIGS', '0044_profile_is_supervisor'),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.RunPython(find_existing_supervisors, migrations.RunPython.noop)
|
|
||||||
]
|
|
||||||
|
Before Width: | Height: | Size: 1.3 MiB After Width: | Height: | Size: 1.3 MiB |
|
Before Width: | Height: | Size: 278 KiB After Width: | Height: | Size: 278 KiB |
|
Before Width: | Height: | Size: 6.3 MiB After Width: | Height: | Size: 5.4 MiB |
|
Before Width: | Height: | Size: 852 KiB After Width: | Height: | Size: 852 KiB |
|
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 18 KiB |
29
package-lock.json
generated
@@ -10173,12 +10173,19 @@
|
|||||||
"integrity": "sha1-Z29us8OZl8LuGsOpJP1hJHSPV40="
|
"integrity": "sha1-Z29us8OZl8LuGsOpJP1hJHSPV40="
|
||||||
},
|
},
|
||||||
"copy-props": {
|
"copy-props": {
|
||||||
"version": "2.0.4",
|
"version": "2.0.5",
|
||||||
"resolved": "https://registry.npmjs.org/copy-props/-/copy-props-2.0.4.tgz",
|
"resolved": "https://registry.npmjs.org/copy-props/-/copy-props-2.0.5.tgz",
|
||||||
"integrity": "sha512-7cjuUME+p+S3HZlbllgsn2CDwS+5eCCX16qBgNC4jgSTf49qR1VKy/Zhl400m0IQXl/bPGEVqncgUUMjrr4s8A==",
|
"integrity": "sha512-XBlx8HSqrT0ObQwmSzM7WE5k8FxTV75h1DX1Z3n6NhQ/UYYAvInWYmG06vFt7hQZArE2fuO62aihiWIVQwh1sw==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"each-props": "^1.3.0",
|
"each-props": "^1.3.2",
|
||||||
"is-plain-object": "^2.0.1"
|
"is-plain-object": "^5.0.0"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"is-plain-object": {
|
||||||
|
"version": "5.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-5.0.0.tgz",
|
||||||
|
"integrity": "sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q=="
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"core-util-is": {
|
"core-util-is": {
|
||||||
@@ -11171,9 +11178,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"follow-redirects": {
|
"follow-redirects": {
|
||||||
"version": "1.14.6",
|
"version": "1.14.7",
|
||||||
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.6.tgz",
|
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.7.tgz",
|
||||||
"integrity": "sha512-fhUl5EwSJbbl8AR+uYL2KQDxLkdSjZGR36xy46AO7cOMTrCMON6Sa28FmAnC2tRTDbd/Uuzz3aJBv7EBN7JH8A==",
|
"integrity": "sha512-+hbxoLbFMbRKDwohX8GkTataGqO6Jb7jGwpAlwgy2bIz25XtRm7KEzJM76R1WiNT5SwZkX4Y75SwBolkpmE7iQ==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"for-in": {
|
"for-in": {
|
||||||
@@ -12892,9 +12899,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"marked": {
|
"marked": {
|
||||||
"version": "4.0.8",
|
"version": "4.0.10",
|
||||||
"resolved": "https://registry.npmjs.org/marked/-/marked-4.0.8.tgz",
|
"resolved": "https://registry.npmjs.org/marked/-/marked-4.0.10.tgz",
|
||||||
"integrity": "sha512-dkpJMIlJpc833hbjjg8jraw1t51e/eKDoG8TFOgc5O0Z77zaYKigYekTDop5AplRoKFGIaoazhYEhGkMtU3IeA=="
|
"integrity": "sha512-+QvuFj0nGgO970fySghXGmuw+Fd0gD2x3+MqCWLIPf5oxdv1Ka6b2q+z9RP01P/IaKPMEramy+7cNy/Lw8c3hw=="
|
||||||
},
|
},
|
||||||
"matchdep": {
|
"matchdep": {
|
||||||
"version": "2.0.0",
|
"version": "2.0.0",
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ class Command(BaseCommand):
|
|||||||
|
|
||||||
if profile:
|
if profile:
|
||||||
self.id_map[child.find('ID').text] = profile.pk
|
self.id_map[child.find('ID').text] = profile.pk
|
||||||
|
print(f"Found existing user {profile}, matching data")
|
||||||
tally[0] += 1
|
tally[0] += 1
|
||||||
else:
|
else:
|
||||||
# PYTHONIC, BABY
|
# PYTHONIC, BABY
|
||||||
@@ -59,6 +60,7 @@ class Command(BaseCommand):
|
|||||||
initials=initials)
|
initials=initials)
|
||||||
self.id_map[child.find('ID').text] = new_profile.pk
|
self.id_map[child.find('ID').text] = new_profile.pk
|
||||||
tally[1] += 1
|
tally[1] += 1
|
||||||
|
print(f"No match found, creating new user {new_profile}")
|
||||||
except AttributeError: # W.T.F
|
except AttributeError: # W.T.F
|
||||||
print("Trainee #{} is FUBAR".format(child.find('ID').text))
|
print("Trainee #{} is FUBAR".format(child.find('ID').text))
|
||||||
|
|
||||||
|
|||||||
@@ -97,17 +97,17 @@ class TraineeList(generic.ListView):
|
|||||||
def get_queryset(self):
|
def get_queryset(self):
|
||||||
q = self.request.GET.get('q', "")
|
q = self.request.GET.get('q', "")
|
||||||
|
|
||||||
fil = Q(first_name__icontains=q) | Q(last_name__icontains=q) | Q(initials__icontains=q)
|
filt = Q(first_name__icontains=q) | Q(last_name__icontains=q) | Q(initials__icontains=q)
|
||||||
|
|
||||||
# try and parse an int
|
# try and parse an int
|
||||||
try:
|
try:
|
||||||
val = int(q)
|
val = int(q)
|
||||||
fil = fil | Q(pk=val)
|
filt = filt | Q(pk=val)
|
||||||
except: # noqa
|
except: # noqa
|
||||||
# not an integer
|
# not an integer
|
||||||
pass
|
pass
|
||||||
|
|
||||||
return self.model.objects.filter(filter).annotate(num_qualifications=Count('qualifications_obtained')).order_by('-num_qualifications').prefetch_related('level_qualifications', 'qualifications_obtained', 'qualifications_obtained__item')
|
return self.model.objects.filter(filt).annotate(num_qualifications=Count('qualifications_obtained')).order_by('-num_qualifications').prefetch_related('level_qualifications', 'qualifications_obtained', 'qualifications_obtained__item')
|
||||||
|
|
||||||
def get_context_data(self, **kwargs):
|
def get_context_data(self, **kwargs):
|
||||||
context = super().get_context_data(**kwargs)
|
context = super().get_context_data(**kwargs)
|
||||||
|
|||||||