Add display names and automatic height calculation
This commit is contained in:
parent
6ccb348361
commit
67bab0af54
308
get.py
308
get.py
@ -123,7 +123,7 @@ def conf_value(xkey: str):
|
|||||||
"fontsize_name": 10,
|
"fontsize_name": 10,
|
||||||
"fontsize_count": 14,
|
"fontsize_count": 14,
|
||||||
"width": 1300,
|
"width": 1300,
|
||||||
"height": 900,
|
"height": 0,
|
||||||
"hmargin": 20,
|
"hmargin": 20,
|
||||||
"parcours_separator": "/",
|
"parcours_separator": "/",
|
||||||
"year_separator": " ",
|
"year_separator": " ",
|
||||||
@ -136,10 +136,10 @@ def conf_value(xkey: str):
|
|||||||
return defaults[xkey]
|
return defaults[xkey]
|
||||||
if xkey[-9:] == "separator":
|
if xkey[-9:] == "separator":
|
||||||
return " "
|
return " "
|
||||||
if xkey == "nick":
|
if xkey == "nick" or xkey == "displayname":
|
||||||
return "{diplome}{rank}{multidepartment}{modalite}{parcours}"
|
return "{diplome}{rank}{multidepartment}{modalite}{parcours}{year}"
|
||||||
if xkey == "extnick":
|
if xkey == "extnick":
|
||||||
return "{rank}{multidepartment}{diplomenobut}{modaliteshort}"
|
return "{ext}{rank}{multidepartment}{diplomenobut}{modaliteshort}"
|
||||||
if xkey == "orders":
|
if xkey == "orders":
|
||||||
return [[], [], [], [], []]
|
return [[], [], [], [], []]
|
||||||
return {}
|
return {}
|
||||||
@ -334,42 +334,9 @@ def get_override(sem, xkey, default=None):
|
|||||||
return default
|
return default
|
||||||
|
|
||||||
|
|
||||||
def analyse_student(semobj, etud, year=None):
|
def nick_replace(
|
||||||
"""Returns the final (department,diplome,rank,modalite,parcours,nickname) tuple from etudid in semid, taking into accounts overrides."""
|
department, diplome, rank, modalite, parcours, nick, year=Options.base_year
|
||||||
session_id = semobj["session_id"].split("-")
|
):
|
||||||
department = session_id[0]
|
|
||||||
diplome = session_id[1]
|
|
||||||
modalite = session_id[2]
|
|
||||||
if year == None:
|
|
||||||
if semobj["semestre_id"] < 0:
|
|
||||||
rank = 1
|
|
||||||
else:
|
|
||||||
rank = (semobj["semestre_id"] + 1) // 2
|
|
||||||
else:
|
|
||||||
rank = year
|
|
||||||
parcours = None
|
|
||||||
groups = []
|
|
||||||
if "groups" in etud:
|
|
||||||
for x in etud["groups"]:
|
|
||||||
if x["partition_name"] == "Parcours":
|
|
||||||
parcours = x["group_name"]
|
|
||||||
groups.append(x["group_name"])
|
|
||||||
if parcours == None:
|
|
||||||
parcours = ""
|
|
||||||
parcours = get_override(semobj, "parcours", parcours)
|
|
||||||
department = get_override(semobj, "department", department)
|
|
||||||
rank = get_override(semobj, "rank", rank)
|
|
||||||
diplome = get_override(semobj, "diplome", diplome)
|
|
||||||
modalite = get_override(semobj, "modalite", modalite)
|
|
||||||
if len(modalite) > 0 and modalite[0] == "G":
|
|
||||||
goal = modalite.split(":")[1:]
|
|
||||||
modalite = None
|
|
||||||
for g in goal:
|
|
||||||
gg = g.split("=")
|
|
||||||
# print(f"Looking for {gg[0]} yielding {gg[1]} out of {groupes}")
|
|
||||||
if gg[0] in groups:
|
|
||||||
modalite = gg[1]
|
|
||||||
nick = conf_value("nick")
|
|
||||||
if len(department) > 0:
|
if len(department) > 0:
|
||||||
nick = nick.replace(
|
nick = nick.replace(
|
||||||
"{department}", conf_value("department_separator") + department
|
"{department}", conf_value("department_separator") + department
|
||||||
@ -386,30 +353,96 @@ def analyse_student(semobj, etud, year=None):
|
|||||||
nick = nick.replace("{diplome}", conf_value("diplome_separator") + diplome)
|
nick = nick.replace("{diplome}", conf_value("diplome_separator") + diplome)
|
||||||
else:
|
else:
|
||||||
nick = nick.replace("{diplome}", "")
|
nick = nick.replace("{diplome}", "")
|
||||||
|
if len(diplome) > 0 and diplome != "BUT":
|
||||||
|
nick = nick.replace("{diplomenobut}", conf_value("diplome_separator") + diplome)
|
||||||
|
else:
|
||||||
|
nick = nick.replace("{diplomenobut}", "")
|
||||||
if len(str(rank)) > 0:
|
if len(str(rank)) > 0:
|
||||||
nick = nick.replace("{rank}", conf_value("rank_separator") + str(rank))
|
nick = nick.replace("{rank}", conf_value("rank_separator") + str(rank))
|
||||||
else:
|
else:
|
||||||
nick = nick.replace("{rank}", "")
|
nick = nick.replace("{rank}", "")
|
||||||
|
nick = nick.replace(
|
||||||
|
"{year}", conf_value("year_separator") + str(Options.base_year + rank - 1)
|
||||||
|
)
|
||||||
|
if diplome != "BUT":
|
||||||
|
nick = nick.replace(
|
||||||
|
"{yearnobut}",
|
||||||
|
conf_value("year_separator") + str(Options.base_year + rank - 1),
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
nick = nick.replace("{yearnobut}", "")
|
||||||
if len(modalite) > 0:
|
if len(modalite) > 0:
|
||||||
nick = nick.replace("{modalite}", conf_value("modalite_separator") + modalite)
|
nick = nick.replace("{modalite}", conf_value("modalite_separator") + modalite)
|
||||||
else:
|
else:
|
||||||
nick = nick.replace("{modalite}", "")
|
nick = nick.replace("{modalite}", "")
|
||||||
|
if len(modalite) > 0 and modalite != "FI":
|
||||||
|
nick = nick.replace("{modaliteshort}", modalite[-1])
|
||||||
|
else:
|
||||||
|
nick = nick.replace("{modaliteshort}", "")
|
||||||
if len(parcours) > 0:
|
if len(parcours) > 0:
|
||||||
nick = nick.replace("{parcours}", conf_value("parcours_separator") + parcours)
|
nick = nick.replace("{parcours}", conf_value("parcours_separator") + parcours)
|
||||||
else:
|
else:
|
||||||
nick = nick.replace("{parcours}", "")
|
nick = nick.replace("{parcours}", "")
|
||||||
formsem_department[str(semobj["id"])] = department
|
extname = "Ecand "
|
||||||
if nick == " BUT 1 GEA EXT":
|
if diplome == "BUT":
|
||||||
print(department, diplome, rank, modalite, parcours, nick)
|
extname = "EXT"
|
||||||
sys.exit(0)
|
nick = nick.replace("{ext}", extname)
|
||||||
return department, diplome, rank, modalite, parcours, nick
|
|
||||||
|
|
||||||
|
|
||||||
def nick(semobj, etud):
|
|
||||||
department, diplome, rank, modalite, parcours, nick = analyse_student(semobj, etud)
|
|
||||||
return nick
|
return nick
|
||||||
|
|
||||||
|
|
||||||
|
def analyse_student(semobj, etud, univ_year=None):
|
||||||
|
"""Returns the final (department,diplome,rank,modalite,parcours,nickname,displayname) tuple from etudid in semid, taking into accounts overrides."""
|
||||||
|
session_id = semobj["session_id"].split("-")
|
||||||
|
year = str(semobj["annee_scolaire"])
|
||||||
|
department = session_id[0]
|
||||||
|
diplome = session_id[1]
|
||||||
|
modalite = session_id[2]
|
||||||
|
if univ_year == None:
|
||||||
|
if semobj["semestre_id"] < 0:
|
||||||
|
rank = 1
|
||||||
|
else:
|
||||||
|
rank = (semobj["semestre_id"] + 1) // 2
|
||||||
|
else:
|
||||||
|
rank = univ_year
|
||||||
|
parcours = None
|
||||||
|
groups = []
|
||||||
|
if "groups" in etud:
|
||||||
|
for x in etud["groups"]:
|
||||||
|
if x["partition_name"] == "Parcours":
|
||||||
|
parcours = x["group_name"]
|
||||||
|
groups.append(x["group_name"])
|
||||||
|
if parcours == None:
|
||||||
|
parcours = ""
|
||||||
|
parcours = get_override(semobj, "parcours", parcours)
|
||||||
|
department = get_override(semobj, "department", department)
|
||||||
|
rank = get_override(semobj, "rank", rank)
|
||||||
|
diplome = get_override(semobj, "diplome", diplome)
|
||||||
|
modalite = get_override(semobj, "modalite", modalite)
|
||||||
|
formsem_department[str(semobj["id"])] = department
|
||||||
|
if len(modalite) > 0 and modalite[0] == "G":
|
||||||
|
goal = modalite.split(":")[1:]
|
||||||
|
modalite = None
|
||||||
|
for g in goal:
|
||||||
|
gg = g.split("=")
|
||||||
|
# print(f"Looking for {gg[0]} yielding {gg[1]} out of {groupes}")
|
||||||
|
if gg[0] in groups:
|
||||||
|
modalite = gg[1]
|
||||||
|
nick = conf_value("nick")
|
||||||
|
nick = nick_replace(department, diplome, rank, modalite, parcours, nick, year)
|
||||||
|
displayname = conf_value("displayname")
|
||||||
|
displayname = nick_replace(
|
||||||
|
department, diplome, rank, modalite, parcours, displayname, year
|
||||||
|
)
|
||||||
|
return department, diplome, rank, modalite, parcours, nick, displayname
|
||||||
|
|
||||||
|
|
||||||
|
def get_nick(semobj, etud):
|
||||||
|
department, diplome, rank, modalite, parcours, nick, displayname = analyse_student(
|
||||||
|
semobj, etud
|
||||||
|
)
|
||||||
|
return nick, displayname
|
||||||
|
|
||||||
|
|
||||||
def get_dept_from_sem(semid):
|
def get_dept_from_sem(semid):
|
||||||
return formsem_department[str(semid)]
|
return formsem_department[str(semid)]
|
||||||
|
|
||||||
@ -471,10 +504,11 @@ def analyse_depts():
|
|||||||
studentsummary["modalite"] = {} # modalite
|
studentsummary["modalite"] = {} # modalite
|
||||||
studentsummary["parcours"] = {} # parcours
|
studentsummary["parcours"] = {} # parcours
|
||||||
studentsummary["nickname"] = {} # nick
|
studentsummary["nickname"] = {} # nick
|
||||||
|
studentsummary["displayname"] = {} # display name
|
||||||
studentsummary["dept"] = dept # useful when merging students
|
studentsummary["dept"] = dept # useful when merging students
|
||||||
studentsummary["bac"] = "" # usually
|
studentsummary["bac"] = "" # usually
|
||||||
department, diplome, rank, modalite, parcours, nick = analyse_student(
|
department, diplome, rank, modalite, parcours, nick, displayname = (
|
||||||
sem, etud, year
|
analyse_student(sem, etud, year)
|
||||||
)
|
)
|
||||||
if "bac" in etud["admission"]:
|
if "bac" in etud["admission"]:
|
||||||
studentsummary["bac"] = etud["admission"]["bac"]
|
studentsummary["bac"] = etud["admission"]["bac"]
|
||||||
@ -483,7 +517,9 @@ def analyse_depts():
|
|||||||
bacs.add(studentsummary["bac"])
|
bacs.add(studentsummary["bac"])
|
||||||
# We skip non-techno students if we are in techno mode
|
# We skip non-techno students if we are in techno mode
|
||||||
# If we want a mixed reporting, maybe we should change this
|
# If we want a mixed reporting, maybe we should change this
|
||||||
if Options.techno and studentsummary["bac"][:2] != "ST": # TODO: change this
|
if (
|
||||||
|
Options.techno and studentsummary["bac"][:2] != "ST"
|
||||||
|
): # TODO: change this
|
||||||
continue
|
continue
|
||||||
if bucket in studentsummary["cursus"]:
|
if bucket in studentsummary["cursus"]:
|
||||||
semestreerreur = int(bucket) + 1
|
semestreerreur = int(bucket) + 1
|
||||||
@ -503,6 +539,7 @@ def analyse_depts():
|
|||||||
studentsummary["modalite"][bucket] = modalite
|
studentsummary["modalite"][bucket] = modalite
|
||||||
studentsummary["parcours"][bucket] = parcours
|
studentsummary["parcours"][bucket] = parcours
|
||||||
studentsummary["nickname"][bucket] = nick
|
studentsummary["nickname"][bucket] = nick
|
||||||
|
studentsummary["displayname"][bucket] = displayname
|
||||||
studentsummary["debug"] = etud["sort_key"] # TODO: REMOVE
|
studentsummary["debug"] = etud["sort_key"] # TODO: REMOVE
|
||||||
studentsummary["unid"] = etud["code_nip"]
|
studentsummary["unid"] = etud["code_nip"]
|
||||||
cohort_nip.add(etud["code_nip"])
|
cohort_nip.add(etud["code_nip"])
|
||||||
@ -514,6 +551,7 @@ analyse_depts()
|
|||||||
|
|
||||||
def allseeingodin():
|
def allseeingodin():
|
||||||
"""This function changes the student lists by peeking in the past and the future to know which students come from another cohort or go into a later cohort."""
|
"""This function changes the student lists by peeking in the past and the future to know which students come from another cohort or go into a later cohort."""
|
||||||
|
displaynames = {}
|
||||||
oldstudents = {}
|
oldstudents = {}
|
||||||
oldstudentslevel = {}
|
oldstudentslevel = {}
|
||||||
futurestudents = {}
|
futurestudents = {}
|
||||||
@ -535,7 +573,9 @@ def allseeingodin():
|
|||||||
continue
|
continue
|
||||||
if nip not in oldstudentslevel or semlevel > oldstudentslevel[nip]:
|
if nip not in oldstudentslevel or semlevel > oldstudentslevel[nip]:
|
||||||
oldstudentslevel[nip] = semlevel
|
oldstudentslevel[nip] = semlevel
|
||||||
oldstudents[nip] = [semid, nick(sem, etud)]
|
nick_t, disp_t = get_nick(sem, etud)
|
||||||
|
oldstudents[nip] = [semid, nick_t]
|
||||||
|
displaynames[nick_t] = disp_t
|
||||||
for semid in futuresems:
|
for semid in futuresems:
|
||||||
sem = cache["sem"][semid]
|
sem = cache["sem"][semid]
|
||||||
if sem["formation"]["type_parcours"] != 700:
|
if sem["formation"]["type_parcours"] != 700:
|
||||||
@ -551,7 +591,7 @@ def allseeingodin():
|
|||||||
continue
|
continue
|
||||||
if nip not in futurestudentslevel or semlevel > futurestudentslevel[nip]:
|
if nip not in futurestudentslevel or semlevel > futurestudentslevel[nip]:
|
||||||
futurestudentslevel[nip] = semlevel
|
futurestudentslevel[nip] = semlevel
|
||||||
futurestudents[nip] = nick(sem, etud)
|
futurestudents[nip], tmp = get_nick(sem, etud)
|
||||||
|
|
||||||
unification = {}
|
unification = {}
|
||||||
|
|
||||||
@ -602,6 +642,7 @@ def allseeingodin():
|
|||||||
"modalite",
|
"modalite",
|
||||||
"parcours",
|
"parcours",
|
||||||
"nickname",
|
"nickname",
|
||||||
|
"displayname",
|
||||||
"old",
|
"old",
|
||||||
"oldsem",
|
"oldsem",
|
||||||
):
|
):
|
||||||
@ -610,14 +651,67 @@ def allseeingodin():
|
|||||||
if bucket not in base[skey]:
|
if bucket not in base[skey]:
|
||||||
base[skey][bucket] = supp[skey][bucket]
|
base[skey][bucket] = supp[skey][bucket]
|
||||||
del student[suppidx]
|
del student[suppidx]
|
||||||
|
foundfirst = False
|
||||||
|
# Ensure all cursus are continuous
|
||||||
|
for etudid in student:
|
||||||
|
etud = student[etudid]
|
||||||
|
foundfirst = False
|
||||||
|
foundlast = False
|
||||||
|
fillblanks = None
|
||||||
|
there = -1
|
||||||
|
for i in range(6):
|
||||||
|
if str(i) in etud["cursus"]:
|
||||||
|
if foundfirst and foundlast:
|
||||||
|
fillblanks = [there, i]
|
||||||
|
else:
|
||||||
|
foundfirst = True
|
||||||
|
here = i
|
||||||
|
else:
|
||||||
|
if not foundfirst:
|
||||||
|
continue
|
||||||
|
foundlast = True
|
||||||
|
there = i
|
||||||
|
if fillblanks is not None:
|
||||||
|
for i in range(fillblanks[0] - 1, fillblanks[1]):
|
||||||
|
bucket = str(i)
|
||||||
|
if bucket not in etud["cursus"]:
|
||||||
|
etud["etudid"][bucket] = etudid
|
||||||
|
etud["cursus"][bucket] = -1
|
||||||
|
etud["pseudodept"][bucket] = "OUT"
|
||||||
|
etud["diplome"][bucket] = "OUT"
|
||||||
|
etud["rank"][bucket] = (i // 2) + 1
|
||||||
|
etud["modalite"][bucket] = "FI"
|
||||||
|
etud["parcours"][bucket] = ""
|
||||||
|
etud["nickname"][bucket] = "OUT" + str(etud["rank"][bucket])
|
||||||
|
etud["displayname"][bucket] = "Césure"
|
||||||
|
displaynames[etud["nickname"][bucket]] = etud["displayname"][bucket]
|
||||||
|
return displaynames
|
||||||
|
|
||||||
|
|
||||||
allseeingodin()
|
displaynames = allseeingodin()
|
||||||
|
|
||||||
strange_cases = []
|
strange_cases = []
|
||||||
next = {}
|
next = {}
|
||||||
nextnick = {}
|
nextnick = {}
|
||||||
|
|
||||||
|
|
||||||
|
def prepare_display(displaynames):
|
||||||
|
for etudid in student:
|
||||||
|
for semlevel in range(5):
|
||||||
|
if str(semlevel) in student[etudid]["nickname"]:
|
||||||
|
a = student[etudid]["nickname"][str(semlevel)]
|
||||||
|
b = student[etudid]["displayname"][str(semlevel)]
|
||||||
|
if a in displaynames:
|
||||||
|
if b != displaynames[a]:
|
||||||
|
die("{a} will be displayed as {b} or {displaynames[a]} !", 6)
|
||||||
|
else:
|
||||||
|
displaynames[a] = b
|
||||||
|
return displaynames
|
||||||
|
|
||||||
|
|
||||||
|
displaynames = prepare_display(displaynames)
|
||||||
|
|
||||||
|
|
||||||
for etudid in student.keys():
|
for etudid in student.keys():
|
||||||
etud = student[etudid]
|
etud = student[etudid]
|
||||||
cursus_array = [None] * 6
|
cursus_array = [None] * 6
|
||||||
@ -738,6 +832,15 @@ unknown = {}
|
|||||||
entries = {}
|
entries = {}
|
||||||
redirs = {}
|
redirs = {}
|
||||||
|
|
||||||
|
finals = {
|
||||||
|
"FAIL": "✘",
|
||||||
|
"RED": "↩",
|
||||||
|
"QUIT": "↴",
|
||||||
|
"+DUT": "➡",
|
||||||
|
"DIPLOME": "✔",
|
||||||
|
"?": "?",
|
||||||
|
}
|
||||||
|
|
||||||
for d in depts:
|
for d in depts:
|
||||||
badred[d] = 0
|
badred[d] = 0
|
||||||
goodred[d] = 0
|
goodred[d] = 0
|
||||||
@ -790,46 +893,48 @@ for etudid in student.keys():
|
|||||||
f"REDI{lastyear} {SCODOC_SERVER}/{ddd}/Scolarite/fiche_etud?etudid={etudid}"
|
f"REDI{lastyear} {SCODOC_SERVER}/{ddd}/Scolarite/fiche_etud?etudid={etudid}"
|
||||||
)
|
)
|
||||||
if resultyear == None:
|
if resultyear == None:
|
||||||
finaloutput = "?" + etud["nickshort"][lastyear]
|
finaloutput = "?"
|
||||||
unknown[ddd] += 1
|
unknown[ddd] += 1
|
||||||
strangecases.append(
|
strangecases.append(
|
||||||
f"????{lastyear} {SCODOC_SERVER}/{ddd}/Scolarite/fiche_etud?etudid={etudid}"
|
f"????{lastyear} {SCODOC_SERVER}/{ddd}/Scolarite/fiche_etud?etudid={etudid}"
|
||||||
)
|
)
|
||||||
elif resultyear in ("RAT", "ATJ"):
|
elif resultyear in ("RAT", "ATJ"):
|
||||||
finaloutput = "?" + etud["nickshort"][lastyear]
|
finaloutput = "?"
|
||||||
unknown[ddd] += 1
|
unknown[ddd] += 1
|
||||||
strangecases.append(
|
strangecases.append(
|
||||||
f"ATTE{lastyear} {SCODOC_SERVER}/{ddd}/Scolarite/fiche_etud?etudid={etudid}"
|
f"ATTE{lastyear} {SCODOC_SERVER}/{ddd}/Scolarite/fiche_etud?etudid={etudid}"
|
||||||
)
|
)
|
||||||
elif resultyear in ("RED", "ABL", "ADSUP"):
|
elif resultyear in ("RED", "ABL", "ADSUP"):
|
||||||
finaloutput = "RED " + etud["nickshort"][lastyear]
|
finaloutput = "RED"
|
||||||
checkred = True
|
checkred = True
|
||||||
elif lastyear == 3 and resultyear in ("ADM", "ADJ"):
|
elif lastyear == 3 and resultyear in ("ADM", "ADJ"):
|
||||||
finaloutput = "DIPLOME " + etud["nickshort"][lastyear]
|
finaloutput = "DIPLOME"
|
||||||
diploma[ddd] += 1
|
diploma[ddd] += 1
|
||||||
elif lastyear == 2 and resultyear in ("ADM", "ADJ"):
|
elif lastyear == 2 and resultyear in ("ADM", "ADJ"):
|
||||||
finaloutput = "+DUT " + etud["nickshort"][lastyear]
|
finaloutput = "+DUT"
|
||||||
reor2[ddd] += 1
|
reor2[ddd] += 1
|
||||||
elif resultyear in ("PAS1NCI", "PASD"):
|
elif resultyear in ("PAS1NCI", "PASD"):
|
||||||
finaloutput = "QUIT " + etud["nickshort"][lastyear]
|
finaloutput = "QUIT"
|
||||||
reor1[ddd] += 1
|
reor1[ddd] += 1
|
||||||
elif lastyear < 2 and resultyear in ("ADM", "ADJ"):
|
elif lastyear < 2 and resultyear in ("ADM", "ADJ"):
|
||||||
finaloutput = "QUIT " + etud["nickshort"][lastyear]
|
finaloutput = "QUIT"
|
||||||
reor1[ddd] += 1
|
reor1[ddd] += 1
|
||||||
elif resultyear in ("NAR", "DEM", "DEF", "ABAN"):
|
elif resultyear in ("NAR", "DEM", "DEF", "ABAN"):
|
||||||
finaloutput = "FAIL " + etud["nickshort"][lastyear]
|
finaloutput = "FAIL"
|
||||||
failure[ddd] += 1
|
failure[ddd] += 1
|
||||||
elif resjury["annee"]["annee_scolaire"] != Options.base_year + lastyear - 1:
|
elif resjury["annee"]["annee_scolaire"] != Options.base_year + lastyear - 1:
|
||||||
finaloutput = "RED " + etud["nickshort"][lastyear]
|
finaloutput = "RED"
|
||||||
checkred = True
|
checkred = True
|
||||||
if checkred:
|
if checkred:
|
||||||
if "future" not in etud:
|
if "future" not in etud:
|
||||||
# print(f"// Mauvais redoublement : {etudid}")
|
# print(f"// Mauvais redoublement : {etudid}")
|
||||||
badred[ddd] += 1
|
badred[ddd] += 1
|
||||||
finaloutput = "FAIL" + finaloutput[3:]
|
finaloutput = "FAIL"
|
||||||
else:
|
else:
|
||||||
goodred[ddd] += 1
|
goodred[ddd] += 1
|
||||||
etud["nickshort"][lastyear + 1] = finaloutput
|
output = finaloutput + " " + etud["nickshort"][lastyear]
|
||||||
|
etud["nickshort"][lastyear + 1] = output
|
||||||
|
displaynames[output] = finals[finaloutput] + etud["nickshort"][lastyear]
|
||||||
(firstsem, firstyear) = (
|
(firstsem, firstyear) = (
|
||||||
(etud["short"][1], 1)
|
(etud["short"][1], 1)
|
||||||
if etud["short"][1] != None
|
if etud["short"][1] != None
|
||||||
@ -840,7 +945,7 @@ for etudid in student.keys():
|
|||||||
firstdept = cache["sem"][firstsem]["departement"]["acronym"]
|
firstdept = cache["sem"][firstsem]["departement"]["acronym"]
|
||||||
if "old" in etud:
|
if "old" in etud:
|
||||||
yearold = cache["sem"][etud["oldsem"]]["annee_scolaire"]
|
yearold = cache["sem"][etud["oldsem"]]["annee_scolaire"]
|
||||||
etud["nickshort"][firstyear - 1] = etud["old"] + " " + str(yearold)
|
etud["nickshort"][firstyear - 1] = etud["old"]
|
||||||
yy = yearold
|
yy = yearold
|
||||||
delta = firstyear + Options.base_year - yy - 2
|
delta = firstyear + Options.base_year - yy - 2
|
||||||
for i in range(delta, firstyear - 1):
|
for i in range(delta, firstyear - 1):
|
||||||
@ -860,53 +965,13 @@ for etudid in student.keys():
|
|||||||
rank = etud["rank"][startsem]
|
rank = etud["rank"][startsem]
|
||||||
modalite = etud["modalite"][startsem]
|
modalite = etud["modalite"][startsem]
|
||||||
parcours = etud["parcours"][startsem]
|
parcours = etud["parcours"][startsem]
|
||||||
nick = conf_value("extnick")
|
nick = "EXT" + conf_value("nick")
|
||||||
if len(department) > 0:
|
nick = nick_replace(department, diplome, rank, modalite, parcours, nick)
|
||||||
nick = nick.replace(
|
displayname = conf_value("extnick")
|
||||||
"{department}", conf_value("department_separator") + department
|
displayname = nick_replace(
|
||||||
|
department, diplome, rank, modalite, parcours, displayname
|
||||||
)
|
)
|
||||||
else:
|
displaynames[nick] = displayname
|
||||||
nick = nick.replace("{department}", "")
|
|
||||||
if len(department) > 0 and len(depts) > 1:
|
|
||||||
nick = nick.replace(
|
|
||||||
"{multidepartment}", conf_value("department_separator") + department
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
nick = nick.replace("{multidepartment}", "")
|
|
||||||
if len(diplome) > 0:
|
|
||||||
nick = nick.replace("{diplome}", conf_value("diplome_separator") + diplome)
|
|
||||||
else:
|
|
||||||
nick = nick.replace("{diplome}", "")
|
|
||||||
if len(diplome) > 0 and diplome != "BUT":
|
|
||||||
nick = nick.replace(
|
|
||||||
"{diplomenobut}", conf_value("diplome_separator") + diplome
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
nick = nick.replace("{diplomenobut}", "")
|
|
||||||
if len(str(rank)) > 0:
|
|
||||||
nick = nick.replace("{rank}", conf_value("rank_separator") + str(rank))
|
|
||||||
else:
|
|
||||||
nick = nick.replace("{rank}", "")
|
|
||||||
if len(modalite) > 0:
|
|
||||||
nick = nick.replace(
|
|
||||||
"{modalite}", conf_value("modalite_separator") + modalite
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
nick = nick.replace("{modalite}", "")
|
|
||||||
if len(modalite) > 0 and modalite != "FI":
|
|
||||||
nick = nick.replace("{modaliteshort}", modalite[-1])
|
|
||||||
else:
|
|
||||||
nick = nick.replace("{modaliteshort}", "")
|
|
||||||
if len(parcours) > 0:
|
|
||||||
nick = nick.replace(
|
|
||||||
"{parcours}", conf_value("parcours_separator") + parcours
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
nick = nick.replace("{parcours}", "")
|
|
||||||
if diplome != "BUT":
|
|
||||||
nick = "Ecand " + nick
|
|
||||||
else:
|
|
||||||
nick = "EXT" + nick
|
|
||||||
etud["nickshort"][firstyear - 1] = nick
|
etud["nickshort"][firstyear - 1] = nick
|
||||||
for i in range(0, firstyear - 1):
|
for i in range(0, firstyear - 1):
|
||||||
etud["nickshort"][i] = nick + "*" * (firstyear - 1 - i)
|
etud["nickshort"][i] = nick + "*" * (firstyear - 1 - i)
|
||||||
@ -1171,7 +1236,20 @@ def printsvg():
|
|||||||
k["out"] = lho
|
k["out"] = lho
|
||||||
if lhi != lho and lhi * lho != 0:
|
if lhi != lho and lhi * lho != 0:
|
||||||
print(f"BUG1: {j} {k} {lhi} {lho}")
|
print(f"BUG1: {j} {k} {lhi} {lho}")
|
||||||
|
print(json.dumps(layer_structure, indent=2))
|
||||||
|
print(json.dumps(node_structure, indent=2))
|
||||||
ls["inout"] += k["size"]
|
ls["inout"] += k["size"]
|
||||||
|
if height == 0:
|
||||||
|
minheight = 0
|
||||||
|
for i in range(5):
|
||||||
|
ls = layer_structure[i]
|
||||||
|
new_minheight = spacing * (ls["num"] - 1) + 2 * hmargin + 2 * ls["inout"]
|
||||||
|
if new_minheight > minheight:
|
||||||
|
minheight = new_minheight
|
||||||
|
height = (1 + (minheight // 150)) * 150
|
||||||
|
|
||||||
|
for i in range(5):
|
||||||
|
ls = layer_structure[i]
|
||||||
ls["density"] = ls["inout"] / (
|
ls["density"] = ls["inout"] / (
|
||||||
spacing + height - spacing * ls["num"] - 2 * hmargin
|
spacing + height - spacing * ls["num"] - 2 * hmargin
|
||||||
)
|
)
|
||||||
@ -1218,7 +1296,7 @@ def printsvg():
|
|||||||
stroke="black",
|
stroke="black",
|
||||||
)
|
)
|
||||||
g1.append(r)
|
g1.append(r)
|
||||||
nw = textwidth(n, "Arial", fontsize_name) * unit_ratio
|
nw = textwidth(displaynames[n], "Arial", fontsize_name) * unit_ratio
|
||||||
cw = textwidth(str(ns["size"]), "Arial", fontsize_count) * unit_ratio
|
cw = textwidth(str(ns["size"]), "Arial", fontsize_count) * unit_ratio
|
||||||
gw = nw + cw + padding
|
gw = nw + cw + padding
|
||||||
ggw = gw + 2 * padding
|
ggw = gw + 2 * padding
|
||||||
@ -1235,7 +1313,7 @@ def printsvg():
|
|||||||
cxpos += gw / 2 + padding + thickness
|
cxpos += gw / 2 + padding + thickness
|
||||||
rxpos += gw / 2 + padding + thickness
|
rxpos += gw / 2 + padding + thickness
|
||||||
t = drawsvg.Text(
|
t = drawsvg.Text(
|
||||||
n,
|
displaynames[n],
|
||||||
str(fontsize_name) + "pt",
|
str(fontsize_name) + "pt",
|
||||||
nxpos,
|
nxpos,
|
||||||
ypos + fontsize_name / 2,
|
ypos + fontsize_name / 2,
|
||||||
|
Loading…
Reference in New Issue
Block a user