Commit 4aac44ff authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

Update thesis.py and recordthesis.py.

parent 58cb6d5b
...@@ -10,6 +10,9 @@ from .checkandfix import CheckException ...@@ -10,6 +10,9 @@ from .checkandfix import CheckException
from plugin_dbui import get_id, UNDEF_ID from plugin_dbui import get_id, UNDEF_ID
T4 = " "*4
class Thesis(Automaton): class Thesis(Automaton):
"""Automaton for thesis. """Automaton for thesis.
...@@ -30,8 +33,7 @@ class Thesis(Automaton): ...@@ -30,8 +33,7 @@ class Thesis(Automaton):
if not Automaton.check_record(self, record): if not Automaton.check_record(self, record):
return False return False
if self.dbg: self.logger.debug(f"{T4}check record (thesis)")
print("check thesis record")
try: try:
self.check.is_thesis(record) self.check.is_thesis(record)
......
...@@ -36,16 +36,17 @@ class RecordThesis(RecordPubli): ...@@ -36,16 +36,17 @@ class RecordThesis(RecordPubli):
# as well as those of directors. The latter have to be removed. # as well as those of directors. The latter have to be removed.
df = self[u"authors"] df = self[u"authors"]
query = df.relator_name != THESIS_DIR if "relator_name" in df:
df = df[df.relator_name != THESIS_DIR]
if sort: if sort:
li = (df.loc[query, ["last_name", "fmt_name"]] li = (df[["last_name", "fmt_name"]]
.sort_values(by="last_name") .sort_values(by="last_name")
.fmt_name .fmt_name
.tolist()) .tolist())
else: else:
li = (df.loc[query].fmt_name li = (df.fmt_name
.sort_index() .sort_index()
.tolist()) .tolist())
...@@ -93,18 +94,22 @@ class RecordThesis(RecordPubli): ...@@ -93,18 +94,22 @@ class RecordThesis(RecordPubli):
# names of the director as well as the name of authors # names of the director as well as the name of authors
df = self[u"authors"] df = self[u"authors"]
if "relator_name" in df:
query = df.relator_name == THESIS_DIR query = df.relator_name == THESIS_DIR
df = df.loc[query] df = df.loc[query]
return (sep.join(df.fmt_name) if len(df) > 0 else u"") return (sep.join(df.fmt_name) if len(df) > 0 else u"")
else:
return ""
def these_universities(self): def these_universities(self):
"""The university(ies) delivering the thesis diploma. """The university(ies) delivering the thesis diploma.
Returns: Returns:
unicode: unicode:
- empty when university(ies) is not defined - empty when university(ies) is not defined
- several univeristy are separated by ``&`` character. - several university are separated by ``&`` character.
""" """
return self._get(u"dissertation_note", u"university") return self._get(u"dissertation_note", u"university")
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment