Compare commits

..

136 Commits

Author SHA1 Message Date
fcff722260 Merge branch 'master' into training
# Conflicts:
#	RIGS/models.py
2022-01-14 18:03:56 +00:00
9f68a6017e Bump pillow to 9.0.0
Closes #464
2022-01-14 14:00:31 +00:00
91ed890f68 Well that was odd 2022-01-12 21:06:18 +00:00
e002ab7bed Big pile of minor code cleanups 2022-01-12 20:54:32 +00:00
3abb73872b Oops 2022-01-12 20:26:28 +00:00
7aba26218f Add an interaction test
Just one. Lol.
2022-01-12 20:24:35 +00:00
aa6bb8410e Swap to better method of validating uniqueness of cable types
SCOPE, Arona, damn it
2022-01-12 19:15:38 +00:00
b4c5493705 Risk assessment form now validates power training status where required 2022-01-12 19:09:20 +00:00
9c8d8f077d Fix logic of filtering secure API requests 2022-01-10 18:19:10 +00:00
6414e68231 Migrate to is_supervisor being a database field
More efficient, but it does reduce app seperation. Probably not an issue for us!
2022-01-09 15:06:11 +00:00
b539312538 Reversion should mostly work now 2022-01-09 14:52:59 +00:00
88dee9477b Double whoops 2022-01-08 18:12:04 +00:00
1984725275 Use a fstring 2022-01-08 18:11:25 +00:00
9db122acb8 Whoops 2022-01-08 18:10:30 +00:00
8e00d86023 use get_or_create when confirming level quals for cases where unconfirmed levels existed in old data 2022-01-08 17:58:06 +00:00
3258094a81 Admin register a bunch more stuff 2022-01-08 17:51:11 +00:00
b9ee6abebd Slightly more testing 2022-01-08 17:36:28 +00:00
f15cfa8fce Slight cleanup 2022-01-08 17:25:23 +00:00
1b32dc2db0 Add a test!
Just one
2022-01-08 17:17:25 +00:00
1490d906ca Update lxml 2022-01-05 20:23:55 +00:00
fe854198fa Revamp level list for better grouping 2022-01-05 12:26:00 +00:00
f8ee1ffb0b Mmm 'responsive' tables 2022-01-04 22:37:42 +00:00
af963ac0eb Only show crown on first page 2022-01-04 22:31:49 +00:00
42ea30931e Fix spelling mistake 2022-01-04 22:26:48 +00:00
b8dc56d129 Fix for new django 2022-01-04 20:31:22 +00:00
f333aa2c18 >.> 2022-01-04 20:20:02 +00:00
9bc2c2b509 Squash migrations 2022-01-04 20:09:04 +00:00
9abb76d4fa That didn't work. Skip those for now 2022-01-04 20:04:54 +00:00
e6af66a964 Potentially fix tests 2022-01-04 19:55:11 +00:00
6c484b984c Revert "Let's try this"
This reverts commit 2a66342cd3.
2022-01-04 19:05:06 +00:00
2a66342cd3 Let's try this 2022-01-04 18:59:50 +00:00
7bd32b3ac5 My kingdom for a space 2022-01-04 18:43:10 +00:00
2a61ee2896 Hmmm 2022-01-04 18:36:27 +00:00
3bac6050f1 Fix broken js in assetaudit
Weird that didn't get picked up before...
2022-01-04 12:36:28 +00:00
7aa37c225d Fix sample data command 2022-01-04 12:28:25 +00:00
215c51e718 Merge branch 'master' into training 2022-01-04 12:08:39 +00:00
fbe4d7271f pep8 2022-01-04 12:08:17 +00:00
2a2f010028 Permissions work 2022-01-04 12:04:38 +00:00
6b19d0e8b8 Fix has_required_levels logic being backward 2022-01-03 15:31:54 +00:00
3e8cfe4f11 Repair confirmation logic 2022-01-03 15:28:17 +00:00
7a70270dfd Add ability to view other users progress on a level
That's kind of important huh :p
2022-01-03 14:59:30 +00:00
5160eb7f78 Add confirm button stuff 2022-01-03 14:38:43 +00:00
99e05d91bb Simpler training level list display 2022-01-02 20:55:32 +00:00
f094ace862 Make level description a text field 2022-01-02 20:53:33 +00:00
945fb393c0 Display prerequisite item requirements on level detail 2022-01-02 20:31:23 +00:00
c6157d3e2b Various fixes 2022-01-02 19:15:44 +00:00
2767777d0e Add ability to edit past training records 2022-01-02 15:39:10 +00:00
19e6585e26 Fix importer not working for notes 2022-01-02 15:03:11 +00:00
747575b968 Add ability to search detailed training record 2022-01-02 14:52:07 +00:00
046d0e461d Fix is_supervisor returning true if user has any levels
Whoops!
2022-01-02 11:15:03 +00:00
b73b8401b6 Add ordering to training level qualification 2022-01-02 11:06:58 +00:00
3fe388af26 Fix importer trying to set pk for qualifications
This doesn't work because of the old DB structure
2022-01-02 11:05:08 +00:00
22dc83d595 Do not display qualified levels also as started 2022-01-02 10:37:48 +00:00
70d4c42676 Much versioning work 2022-01-01 19:53:03 +00:00
0727a23236 Some reversion fiddling 2021-12-31 18:23:38 +00:00
f0b3a6daf3 Filter for active training items
Can't easily filter by supervisor, its not a database field, argh...
2021-12-29 13:07:30 +00:00
3c5f6da363 Fix selectpickers disappearing on modal errors 2021-12-29 12:48:34 +00:00
ee9be86465 Do not display items on trainee detail
That's what the detailed view is for...

And definitely nowt to do with my horrifically optimised SQL
2021-12-28 22:23:17 +00:00
5554edf977 Cleanup 2021-12-28 21:58:56 +00:00
14b73f6f50 Somewhat optimised SQL on level detail 2021-12-28 21:35:21 +00:00
732affa0b2 SQL optimisation of detailed training record 2021-12-28 12:13:08 +00:00
7c830ee7e5 Fix sorting of items
W.T.F past self. Char field for a reference number?!
2021-12-28 11:46:52 +00:00
d47d00d79b Rework item list display 2021-12-28 11:36:46 +00:00
3b5b3b84d4 Significant improvements to level list
Added search
Ordered by qualification count
Added display for technician qualifications
2021-12-27 14:59:30 +00:00
aa8be6a6d0 Rework level list display 2021-12-23 13:29:04 +00:00
640362c203 Importer sets up level heirarchy 2021-12-23 13:28:56 +00:00
71a8823ac2 Markdown support on level desc 2021-12-23 11:31:44 +00:00
c6de3dc9e2 Merge branch 'master' into training 2021-12-22 21:52:04 +00:00
8696bf5d94 SQL query optimisation 2021-12-22 11:09:54 +00:00
0d9bf89180 Merge branch 'master' into training
# Conflicts:
#	templates/base.html
2021-12-21 19:53:17 +00:00
f4f2fbdc03 Tweak training level display 2021-12-21 19:07:39 +00:00
67aaada9e8 Import confirmation date for training level qualifications 2021-12-21 19:05:25 +00:00
fcae39c93c Add constraint that training items must have unique reference numbers 2021-12-21 15:51:44 +00:00
d1970edfb3 Change display of 'users with this level' 2021-12-21 15:12:11 +00:00
ce5efff268 Initial work on requirements importer 2021-12-21 13:38:00 +00:00
522837c64e Importer works. Doesn't yet compensate for crap data quality. 2021-10-27 16:42:52 +01:00
e78decdf92 finshed inport old db untested 2021-10-27 14:04:01 +01:00
84a3c9db24 made database importer untested 2021-10-27 13:18:28 +01:00
280a1d9604 begin work on perms 2021-10-22 16:13:08 +01:00
a184bbfa26 Much template wrangling 2021-10-22 15:57:20 +01:00
4416e5bfcb Add RevisionMixin in the right places 2021-10-20 21:15:59 +01:00
21276bcca0 You may not confirm your own training 2021-10-20 21:06:59 +01:00
bc465d67e9 Convert requirement addition to a modal 2021-10-20 21:02:19 +01:00
a644735cd6 Merge branch 'master' into training 2021-10-20 20:22:59 +01:00
10326f884f Fix the modal fuckery 2021-10-20 20:15:13 +01:00
0a0c9f15af Common competencies also do not count for being a supervisor 2021-10-09 10:38:40 +01:00
dbb9e3e530 Add 'is van driver' to trainee list, haulage super doesn't count as a supervisor 2021-10-09 10:29:03 +01:00
55558d1a4a Merge branch 'master' into training
# Conflicts:
#	RIGS/templates/risk_assessment_form.html
#	templates/base.html
2021-10-08 18:40:39 +01:00
081c33ebc8 Various tweaks 2021-09-13 01:07:17 +01:00
75410db752 Refactor is_supervisor 2021-09-13 00:49:02 +01:00
06c6b9a36e Change homepage links to match header ones 2021-09-12 20:26:05 +01:00
13b1cea28b Fancy training level list layout 2021-09-12 18:08:13 +01:00
cddb76bf7e Order training items by number 2021-09-08 20:44:02 +01:00
f4f1fb66a2 Leaderboard of qualifications obtained 2021-09-08 20:44:02 +01:00
d80aeca01f Add training level list
Plus various other fettling
2021-09-03 22:34:25 +01:00
45dfe2db51 Work on trainee reversion 2021-09-02 10:23:53 +01:00
de5997b9da Reversion working for training level 2021-08-29 22:19:30 +01:00
4a121964dc Start training navbar 2021-08-21 11:42:31 +01:00
df5e4c8e0a Level detail tweaking 2021-08-21 01:44:26 +01:00
3601c14ab7 Oops 2021-08-21 01:36:35 +01:00
adde6496f5 Add loads more sample training items
Hopefully the generator won't make levels with no requirements anymore now
2021-08-21 00:45:35 +01:00
ad734d94b2 Display pre pre requisite levels on level detail 2021-08-21 00:32:04 +01:00
7d3ada822d Common competencies sample data 2021-08-21 00:28:24 +01:00
732af53fda Groundwork stuff for common competencies + other fixes 2021-08-21 00:09:00 +01:00
4fb0529cc0 Modalify the training record addition form 2021-08-20 21:52:33 +01:00
aa23b1cd09 Add sharepoint link to new homepage
Good at scope, me
2021-08-20 21:52:17 +01:00
0c4228da57 Add a view for a trainee's item record 2021-08-20 14:26:32 +01:00
246a52d19e Don't try and create existing level qualifications 2021-08-20 13:48:30 +01:00
8b10aaf700 Display users with level on level detail page 2021-08-20 12:48:54 +01:00
4d0d4f02aa Generate a sample supervisor 2021-08-20 12:38:30 +01:00
af987c1ebb Make TrainingLevelRequirement the correct level of unique
Also updates generateSampleData to match
2021-08-19 18:47:38 +01:00
d406a911bb Initial refactoring of profile detail 2021-08-19 18:27:52 +01:00
63c5a68933 Goddamnit 2021-08-19 18:12:15 +01:00
66f7f830db Forgot that needed migrations generating 2021-08-19 18:08:57 +01:00
9590c2066d Validate that only supervisors may be supervisors 2021-08-19 16:19:46 +01:00
8b48b02ca7 Force trainingitemqualifications to be unique 2021-08-19 16:00:31 +01:00
68e7ec2a0d Merge branch 'master' into training 2021-08-19 15:49:16 +01:00
5779ebdf7e Merge branch 'master' into training
# Conflicts:
#	templates/base.html
2021-08-17 21:35:10 +01:00
be648c20d5 Level confirmation works 2021-07-29 23:41:35 +01:00
b6ef7c1d89 Force traininglevelqualifications to be unique 2021-07-29 23:15:09 +01:00
85f40b358a Some attempts at optimising SQL queries
New high score!
2021-07-29 22:49:27 +01:00
2698798035 Percentage complete works
Ain't half slow though!
2021-07-16 04:05:55 +01:00
dbaab5cf8c Autofire of traininglevelqualification basically works 2021-07-16 02:58:42 +01:00
0a9f82e480 Fettling with level granting logic
Untested as all of my forms broke I guess
2021-07-07 17:38:44 +01:00
54f2bd36bd UI for editing training level requirements 2021-07-06 22:10:15 +01:00
e836195fef mild polishing 2021-07-06 14:51:43 +01:00
68a424d62b Some sample data and UX work 2021-07-06 12:16:43 +01:00
5e15b8bb59 Basic UX for adding requirements to training levels 2021-07-06 11:37:04 +01:00
d26c1b535e item ui vaguely working 2021-07-06 00:09:46 +01:00
dff5ac2308 Whee broken HEAD 2021-07-05 23:24:13 +01:00
a3729fa930 Session log form work 2021-07-05 18:24:24 +01:00
458a734331 Machine switch 2021-07-01 09:50:13 +01:00
b1646d556c Start work on sample data command 2021-06-30 15:56:28 +01:00
f8624d3b7a Restructure based on actual thought put in by @mattysmith22 2021-06-30 15:17:00 +01:00
f6836fdab6 Merge branch 'master' into training 2021-06-29 17:17:48 +01:00
b3949f2903 Initial sketching 2021-06-29 17:13:36 +01:00
9 changed files with 39 additions and 23 deletions

View File

@@ -0,0 +1,25 @@
# 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)
]

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 MiB

After

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 278 KiB

After

Width:  |  Height:  |  Size: 278 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.4 MiB

After

Width:  |  Height:  |  Size: 6.3 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 852 KiB

After

Width:  |  Height:  |  Size: 852 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 24 KiB

29
package-lock.json generated
View File

@@ -10173,19 +10173,12 @@
"integrity": "sha1-Z29us8OZl8LuGsOpJP1hJHSPV40="
},
"copy-props": {
"version": "2.0.5",
"resolved": "https://registry.npmjs.org/copy-props/-/copy-props-2.0.5.tgz",
"integrity": "sha512-XBlx8HSqrT0ObQwmSzM7WE5k8FxTV75h1DX1Z3n6NhQ/UYYAvInWYmG06vFt7hQZArE2fuO62aihiWIVQwh1sw==",
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/copy-props/-/copy-props-2.0.4.tgz",
"integrity": "sha512-7cjuUME+p+S3HZlbllgsn2CDwS+5eCCX16qBgNC4jgSTf49qR1VKy/Zhl400m0IQXl/bPGEVqncgUUMjrr4s8A==",
"requires": {
"each-props": "^1.3.2",
"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=="
}
"each-props": "^1.3.0",
"is-plain-object": "^2.0.1"
}
},
"core-util-is": {
@@ -11178,9 +11171,9 @@
}
},
"follow-redirects": {
"version": "1.14.7",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.7.tgz",
"integrity": "sha512-+hbxoLbFMbRKDwohX8GkTataGqO6Jb7jGwpAlwgy2bIz25XtRm7KEzJM76R1WiNT5SwZkX4Y75SwBolkpmE7iQ==",
"version": "1.14.6",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.6.tgz",
"integrity": "sha512-fhUl5EwSJbbl8AR+uYL2KQDxLkdSjZGR36xy46AO7cOMTrCMON6Sa28FmAnC2tRTDbd/Uuzz3aJBv7EBN7JH8A==",
"dev": true
},
"for-in": {
@@ -12899,9 +12892,9 @@
}
},
"marked": {
"version": "4.0.10",
"resolved": "https://registry.npmjs.org/marked/-/marked-4.0.10.tgz",
"integrity": "sha512-+QvuFj0nGgO970fySghXGmuw+Fd0gD2x3+MqCWLIPf5oxdv1Ka6b2q+z9RP01P/IaKPMEramy+7cNy/Lw8c3hw=="
"version": "4.0.8",
"resolved": "https://registry.npmjs.org/marked/-/marked-4.0.8.tgz",
"integrity": "sha512-dkpJMIlJpc833hbjjg8jraw1t51e/eKDoG8TFOgc5O0Z77zaYKigYekTDop5AplRoKFGIaoazhYEhGkMtU3IeA=="
},
"matchdep": {
"version": "2.0.0",

View File

@@ -48,7 +48,6 @@ class Command(BaseCommand):
if profile:
self.id_map[child.find('ID').text] = profile.pk
print(f"Found existing user {profile}, matching data")
tally[0] += 1
else:
# PYTHONIC, BABY
@@ -60,7 +59,6 @@ class Command(BaseCommand):
initials=initials)
self.id_map[child.find('ID').text] = new_profile.pk
tally[1] += 1
print(f"No match found, creating new user {new_profile}")
except AttributeError: # W.T.F
print("Trainee #{} is FUBAR".format(child.find('ID').text))

View File

@@ -97,17 +97,17 @@ class TraineeList(generic.ListView):
def get_queryset(self):
q = self.request.GET.get('q', "")
filt = Q(first_name__icontains=q) | Q(last_name__icontains=q) | Q(initials__icontains=q)
fil = Q(first_name__icontains=q) | Q(last_name__icontains=q) | Q(initials__icontains=q)
# try and parse an int
try:
val = int(q)
filt = filt | Q(pk=val)
fil = fil | Q(pk=val)
except: # noqa
# not an integer
pass
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')
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')
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)