many changes

This commit is contained in:
Ross
2022-01-24 18:25:36 +00:00
parent 85c1344737
commit a34631bc22
15 changed files with 1821 additions and 738 deletions
+12 -8
View File
@@ -8,9 +8,9 @@ import uuid
class Worker:
def __init__(
self,
Rota,
name,
site,
Rota, # Aim to remove (workers should be independent of rotas)
name: str,
site: str,
grade: int,
id=None,
fte: int = 100,
@@ -27,7 +27,7 @@ class Worker:
pair: int = 0,
):
# We can either have a user generated ID
# We can either have a user generated ID
if id is not None:
self.id = id
else:
@@ -147,6 +147,7 @@ class Worker:
# Calculate the proportion of the rota that is being worked
self.proportion_rota_to_work = days_to_work / Rota.rota_days_length
self.days_to_work = days_to_work
# We have to adjust the full time equivalent for people who CCT / leave the rota early
self.fte_adj = self.fte * self.proportion_rota_to_work
@@ -156,7 +157,7 @@ class Worker:
# print(self.name, self.nwd)
def __lt__(self, other):
def __lt__(self, other) -> bool:
return (self.site, self.grade, self.fte_adj, self.name) < (
other.site,
other.grade,
@@ -164,7 +165,7 @@ class Worker:
other.name,
)
def __str__(self):
def __str__(self) -> str:
nwd = ", ".join([str(i) for i in self.nwd]) if self.nwd is not None else ""
return "{} {} [{}] PROC SITE:{} ({})".format(
@@ -175,8 +176,11 @@ class Worker:
self.night_at_derriford,
)
def get_details(self):
def get_details(self) -> str:
return "{} {} {}".format(self.id, self.site[0], self.grade)
def get_full_details(self):
def get_full_details(self) -> str:
return "{}/{}/{}".format(self.site, self.grade, self.name)
def get_shift_targets(self) -> dict:
return self.shift_target_number