Skip to content

Commit

Permalink
Aggiunto ordinamento per cognome
Browse files Browse the repository at this point in the history
  • Loading branch information
MattiaOldani committed Aug 3, 2023
1 parent 228839a commit 22f1000
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion generator/form/form.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def generate_dat_file():
turns = dict()
names = list()
for entry in entries:
name = entry["Field1"].strip() + ''.join(entry["Field2"].strip().split(" "))
name = ''.join(entry["Field2"].strip().split(" ")) + entry["Field1"].strip()
names.append(name)

pre = list()
Expand Down
10 changes: 0 additions & 10 deletions generator/template/template.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,21 +57,11 @@ def generate_template():

turns = Turns(results)

def format(name):
find = name[1]
results = find[0]
for char in find[1:]:
if char.isupper():
results += " "
results += char
return (name[0], results)

with open("template.typ", "a") as f:
for slot in Slots:
f.write(f"\t[_{slot.name}_], ")
for day in Days:
animators = turns.get_animators(slot, day)
animators = list(map(format, animators))
names = ", ".join([a[1] for a in animators])
if names == "":
names = "-"
Expand Down
14 changes: 12 additions & 2 deletions generator/utils/turns.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@ def compare(x,y):
return x[0].value - y[0].value
compare = cmp_to_key(compare)

def format(name):
results = name[0]
for char in name[1:]:
if char.isupper():
results += " "
results += char
return results

turns = dict()
animators = set()
for slot in Slots:
Expand All @@ -24,7 +32,7 @@ def compare(x,y):
results = results[i+3:]
break
else:
animator = row.split(" ")[0]
animator = format(row.split(" ")[0])
animators.add(animator)
keep = list(filter(lambda x : x in ("0","1"), row.split(" ")))
for day in Days:
Expand All @@ -41,7 +49,8 @@ def compare(x,y):
row = row.strip().split(" ")
row = list(filter(lambda x : x != "", row))
for i in range(0,len(row),2):
counts[row[i]] = int(row[i+1])
name = format(row[i])
counts[name] = int(row[i+1])

max_ = int(results.pop(0).split(" ")[2])
min_ = int(results.pop(0).split(" ")[2])
Expand Down Expand Up @@ -74,6 +83,7 @@ def compare(x,y):

def get_animators_turns_counts(self, sort=False, reverse=False):
counts = list(self.counts.items())
counts.sort(key=lambda x : x[0])

match [isinstance(sort,bool),isinstance(reverse,bool)]:
case [True,True]:
Expand Down

0 comments on commit 22f1000

Please sign in to comment.