feat: add documentation for ELSA and extend functionality, include new icons and update semester logic
2
docs/citing.md
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
# Zitieren
|
||||||
|
|
||||||
25
docs/elsa.md
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
# ELSA
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
## ELSA anlegen
|
||||||
|
Um einen ELSA zu erstellen, muss der Knopf **Neuer Auftrag** gedrückt werden. Das Feld *Auftragsdaten* wird zum bearbeiten freigeschaltet, der Fokus wird automatisch auf das Feld **Prof.** gesetzt.
|
||||||
|
|
||||||
|
Hier werden automatisch alle bereits vorhandenen Professoren der Semesterapparate eingetragen. Sollte der Professor noch keinen Apparat haben, so kann der Name manuell eingetragen werden. Die ELSA Profs werden in einer anderen Tabelle der Datenbank gespeichert, als die Professoren der Semesterapparate. Deshalb kann hier keine [Mail](mail.md) an den Professor geschickt werden.
|
||||||
|
|
||||||
|
### Dokumente hinzufügen
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
Um den ELSA zu speichern, müssen alle Felder ausgefüllt sein. Nach dem Speichern wird der ELSA in der Tabelle angezeigt. Über das Icon  können der aktuelle Tag und das aktuelle Semester eingetragen werden.
|
||||||
|
|
||||||
|
Hat der Professor ein passendes Formular geliefert, so kann dieses über den Knopf **Dokument hinzufügen** hinzugefügt werden. Das Dokument wird in der Datenbank gespeichert und kann über den Knopf **Dokument öffnen** geöffnet werden. Über den Knopf **Medien aus Dokument hinzufügen** werden alle erkannten Medien aus dem Dokument in die Tabelle eingetragen und können zitiert werden.
|
||||||
|
|
||||||
|
!!! Info
|
||||||
|
Durch den Klick auf den Knopf **Medien aus Dokument hinzufügen** wird der Auftrag automatisch gespeichert.
|
||||||
|
|
||||||
|
### Einträge zitieren
|
||||||
|
|
||||||
|
Da alle gescannten Dokumente später auf Illias hochgeladen werden, gibt es die Funktion **Eintrag zitieren**. Für diese Funktion muss ein Eintrag in der Tabelle ausgewählt werden. Über den Knopf **Eintrag zitieren** wird ein Dialog geöffnet, in dem der Eintrag zitiert werden kann.
|
||||||
|
Genauere Beschreibung: [Zitieren](citing.md)
|
||||||
|
|
||||||
12
docs/extend.md
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
# Verlängerung
|
||||||
|
|
||||||
|
Ein Dialog zum Verlängern eines Apparates.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
Zum Verlängern muss ein Semester ausgewählt, und ein Jahr eingetragen sein. Die Checkbox für den Dauerapparat kann angekreuzt werden, um den Apparat als Dauerapparat zu markieren.
|
||||||
|
|
||||||
|
!!! Info "Info Dauerapparat"
|
||||||
|
Damit der Apparat als Dauerapparat verlängert werden kann, muss ein Semester angegeben werden.
|
||||||
|
|
||||||
|
Nach dem Speichern wird das Semester automatisch angepasst und in den entsprechenden Tabellen angezeigt.
|
||||||
BIN
docs/images/elsa_data.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
BIN
docs/images/elsa_docs.png
Normal file
|
After Width: | Height: | Size: 4.9 KiB |
BIN
docs/images/elsa_main.png
Normal file
|
After Width: | Height: | Size: 26 KiB |
BIN
docs/images/elsa_stats_graph.png
Normal file
|
After Width: | Height: | Size: 6.6 KiB |
BIN
docs/images/elsa_stats_table.png
Normal file
|
After Width: | Height: | Size: 4.4 KiB |
BIN
docs/images/extend.png
Normal file
|
After Width: | Height: | Size: 7.9 KiB |
BIN
docs/images/icon_cal.png
Normal file
|
After Width: | Height: | Size: 382 B |
@@ -57,6 +57,17 @@ Mit dem Klick auf den Button wird ein neues Fenster geöffnet:
|
|||||||
|
|
||||||
Bevor die Mail abgeschickt werden kann, muss die Anrede konfiguriert werden. Weitere Infors finden Sie im Abschnitt [Mails](mail.md).
|
Bevor die Mail abgeschickt werden kann, muss die Anrede konfiguriert werden. Weitere Infors finden Sie im Abschnitt [Mails](mail.md).
|
||||||
|
|
||||||
|
#### Kontextmenü
|
||||||
|
|
||||||
|
Diese Tabelle bietet auch ein Rechtsklickmenu mit folgenden Optionen:
|
||||||
|
|
||||||
|
- **Verlängern**: Öffnet den [Verlängerungsdialog](extend.md)
|
||||||
|
- **Wiederherstellen**: Stellt einen gelöschten Apparat wieder her
|
||||||
|
|
||||||
|
!!! Info "Info: Wiederherstellen"
|
||||||
|
Diese Option kann für einen oder mehrere gelöschte Apparate verwendet werden. Für mehrere Apprate müssen die entsprechenden Zeilen mit Strg+Klick auf die Zeilennummer markiert werden.
|
||||||
|
|
||||||
|
|
||||||
### Apparatsstatistik
|
### Apparatsstatistik
|
||||||
Rechts neben der Tabelle wird die Statistik der gefundenen Apparate angezeigt:
|
Rechts neben der Tabelle wird die Statistik der gefundenen Apparate angezeigt:
|
||||||

|

|
||||||
@@ -90,4 +101,3 @@ Der Suchbereich kann verwendet werden, um zu prüfen, ob ein Exemplar in einem A
|
|||||||
!!! Info "Info: Exemplarsuche"
|
!!! Info "Info: Exemplarsuche"
|
||||||
Im Vergleich zur Apparatssuche kann hier keine Leere Suche durchgeführt werden, da ggf. zu viele Ergebnisse angezeigt werden können.
|
Im Vergleich zur Apparatssuche kann hier keine Leere Suche durchgeführt werden, da ggf. zu viele Ergebnisse angezeigt werden können.
|
||||||
|
|
||||||
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
icon_path: icons/
|
icon_path: icons/
|
||||||
|
|
||||||
dark_color: '#75FB4C'
|
dark_color: '#75FB4Cmail'
|
||||||
light_color: '#EA3323'
|
light_color: '#EA3323'
|
||||||
icons:
|
icons:
|
||||||
locked: locked.svg
|
locked: locked.svg
|
||||||
@@ -24,4 +24,5 @@ icons:
|
|||||||
valid_true: check_success.svg
|
valid_true: check_success.svg
|
||||||
valid_false: check_fail.svg
|
valid_false: check_fail.svg
|
||||||
edit: edit.svg
|
edit: edit.svg
|
||||||
important_warn : red_warn.svg
|
important_warn : red_warn.svg
|
||||||
|
person: person_add.svg
|
||||||
1
icons/person_add.svg
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#e8eaed"><path d="M720-400v-120H600v-80h120v-120h80v120h120v80H800v120h-80Zm-360-80q-66 0-113-47t-47-113q0-66 47-113t113-47q66 0 113 47t47 113q0 66-47 113t-113 47ZM40-160v-112q0-34 17.5-62.5T104-378q62-31 126-46.5T360-440q66 0 130 15.5T616-378q29 15 46.5 43.5T680-272v112H40Zm80-80h480v-32q0-11-5.5-20T580-306q-54-27-109-40.5T360-360q-56 0-111 13.5T140-306q-9 5-14.5 14t-5.5 20v32Zm240-320q33 0 56.5-23.5T440-640q0-33-23.5-56.5T360-720q-33 0-56.5 23.5T280-640q0 33 23.5 56.5T360-560Zm0-80Zm0 400Z"/></svg>
|
||||||
|
After Width: | Height: | Size: 603 B |
@@ -11,7 +11,6 @@ from omegaconf import OmegaConf
|
|||||||
from src.backend.db import (
|
from src.backend.db import (
|
||||||
CREATE_ELSA_FILES_TABLE,
|
CREATE_ELSA_FILES_TABLE,
|
||||||
CREATE_ELSA_MEDIA_TABLE,
|
CREATE_ELSA_MEDIA_TABLE,
|
||||||
CREATE_ELSA_PROF_TABLE,
|
|
||||||
CREATE_ELSA_TABLE,
|
CREATE_ELSA_TABLE,
|
||||||
CREATE_TABLE_APPARAT,
|
CREATE_TABLE_APPARAT,
|
||||||
CREATE_TABLE_APPKONTOS,
|
CREATE_TABLE_APPKONTOS,
|
||||||
@@ -1203,7 +1202,8 @@ class Database:
|
|||||||
Returns:
|
Returns:
|
||||||
list[str]: a list of all the roles
|
list[str]: a list of all the roles
|
||||||
"""
|
"""
|
||||||
return self.query_db("SELECT role FROM user")
|
roles = self.query_db("SELECT role FROM user")
|
||||||
|
return [i[0] for i in roles]
|
||||||
|
|
||||||
def checkUsername(self, user) -> bool:
|
def checkUsername(self, user) -> bool:
|
||||||
"""a check to see if the username is already present in the database
|
"""a check to see if the username is already present in the database
|
||||||
@@ -1311,26 +1311,29 @@ class Database:
|
|||||||
)
|
)
|
||||||
|
|
||||||
# ELSA
|
# ELSA
|
||||||
def createElsaProf(self, name):
|
|
||||||
"""create a new professor in the database for the ELSA system
|
|
||||||
|
|
||||||
Args:
|
def createElsaApparat(self, date, prof_id, semester) -> int:
|
||||||
name (str): the name of the professor
|
|
||||||
"""
|
|
||||||
self.query_db("INSERT INTO elsa_prof (name) VALUES (?)", (name,))
|
|
||||||
|
|
||||||
def createElsaApparat(self, date, prof_id, semester):
|
|
||||||
"""create a new apparat in the database for the ELSA system
|
"""create a new apparat in the database for the ELSA system
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
date (str): the name of the apparat
|
date (str): the name of the apparat
|
||||||
prof_id (int): the id of the professor
|
prof_id (int): the id of the professor
|
||||||
semester (str): the semester the apparat is created in
|
semester (str): the semester the apparat is created in
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
int: the id of the apparat
|
||||||
"""
|
"""
|
||||||
self.query_db(
|
self.query_db(
|
||||||
"INSERT OR IGNORE INTO elsa (date, prof_id, semester) VALUES (?,?,?)",
|
"INSERT OR IGNORE INTO elsa (date, prof_id, semester) VALUES (?,?,?)",
|
||||||
(date, prof_id, semester),
|
(date, prof_id, semester),
|
||||||
)
|
)
|
||||||
|
# get the id of the apparat
|
||||||
|
apparat_id = self.query_db(
|
||||||
|
"SELECT id FROM elsa WHERE date=? AND prof_id=? AND semester=?",
|
||||||
|
(date, prof_id, semester),
|
||||||
|
one=True,
|
||||||
|
)[0]
|
||||||
|
return apparat_id
|
||||||
|
|
||||||
def updateElsaApparat(self, date, prof_id, semester, elsa_id):
|
def updateElsaApparat(self, date, prof_id, semester, elsa_id):
|
||||||
"""update an ELSA apparat in the database
|
"""update an ELSA apparat in the database
|
||||||
@@ -1446,9 +1449,13 @@ class Database:
|
|||||||
Returns:
|
Returns:
|
||||||
int: the id of the ELSA apparat
|
int: the id of the ELSA apparat
|
||||||
"""
|
"""
|
||||||
|
prof_id = self.getElsaProfId(prof)
|
||||||
|
if prof_id is None:
|
||||||
|
return None
|
||||||
|
|
||||||
data = self.query_db(
|
data = self.query_db(
|
||||||
"SELECT id FROM elsa WHERE prof_id=? AND semester=? AND date=?",
|
"SELECT id FROM elsa WHERE prof_id=? AND semester=? AND date=?",
|
||||||
(prof, semester, date),
|
(prof_id, semester, date),
|
||||||
one=True,
|
one=True,
|
||||||
)
|
)
|
||||||
if data is None:
|
if data is None:
|
||||||
@@ -1497,22 +1504,7 @@ class Database:
|
|||||||
if data:
|
if data:
|
||||||
return data[0][0]
|
return data[0][0]
|
||||||
else: return None
|
else: return None
|
||||||
|
|
||||||
def createElsaProf(self, profname)-> int:
|
|
||||||
pId = self.getElsaProfId(profname)
|
|
||||||
if pId:
|
|
||||||
return pId
|
|
||||||
query = f"INSERT INTO elsa_prof (fullname) VALUES ('{profname}')"
|
|
||||||
self.query_db(query)
|
|
||||||
return self.getElsaProfId(profname)
|
|
||||||
|
|
||||||
def getElsaProf(self, prof_id)->str:
|
|
||||||
query = f"SELECT fullname FROM elsa_prof WHERE id = '{prof_id}'"
|
|
||||||
data = self.query_db(query)
|
|
||||||
if data:
|
|
||||||
return data[0][0]
|
|
||||||
else: return None
|
|
||||||
|
|
||||||
def getElsaProfs(self)->list[str]:
|
def getElsaProfs(self)->list[str]:
|
||||||
query = f"SELECT fullname FROM elsa_prof"
|
query = f"SELECT fullname FROM elsa_prof"
|
||||||
data = self.query_db(query)
|
data = self.query_db(query)
|
||||||
@@ -1521,6 +1513,14 @@ class Database:
|
|||||||
else: return []
|
else: return []
|
||||||
|
|
||||||
def getProfId(self, profdata: dict|Prof):
|
def getProfId(self, profdata: dict|Prof):
|
||||||
|
"""Get the prof ID based on the profdata
|
||||||
|
|
||||||
|
Args:
|
||||||
|
profdata (dict | Prof): either a dictionary containing the prof data or a Prof object
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
int | None: The id of the prof or None if not found
|
||||||
|
"""
|
||||||
conn = self.connect()
|
conn = self.connect()
|
||||||
cursor = conn.cursor()
|
cursor = conn.cursor()
|
||||||
if isinstance(profdata, Prof):
|
if isinstance(profdata, Prof):
|
||||||
@@ -1557,8 +1557,61 @@ class Database:
|
|||||||
if result:
|
if result:
|
||||||
return Prof().from_tuple(result)
|
return Prof().from_tuple(result)
|
||||||
else: return Prof()
|
else: return Prof()
|
||||||
def getProfNameByApparat(self, apprarat_id):
|
|
||||||
query = f"SELECT prof_id from semesterapparat WHERE appnr = '{apprarat_id}'"
|
def getProfIDByApparat(self, apprarat_id):
|
||||||
|
"""Get the prof id based on the semesterapparat id from the database
|
||||||
|
|
||||||
|
Args:
|
||||||
|
apprarat_id (int): Number of the apparat
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
int | None: The id of the prof or None if not found
|
||||||
|
"""
|
||||||
|
query = f"SELECT prof_id from semesterapparat WHERE id = '{apprarat_id}' and deletion_status = 0"
|
||||||
|
data = self.query_db(query)
|
||||||
|
if data:
|
||||||
|
return data[0][0]
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
|
def copyBookToApparat(self, book_id, apparat):
|
||||||
|
# get book data
|
||||||
|
new_apparat_id = apparat
|
||||||
|
new_prof_id = self.getProfIDByApparat(new_apparat_id)
|
||||||
|
query = f"""
|
||||||
|
INSERT INTO media (bookdata, app_id, prof_id, deleted, available, reservation)
|
||||||
|
SELECT
|
||||||
|
bookdata,
|
||||||
|
'{new_apparat_id}',
|
||||||
|
'{new_prof_id}',
|
||||||
|
0,
|
||||||
|
available,
|
||||||
|
reservation
|
||||||
|
FROM media
|
||||||
|
where id = '{book_id}'"""
|
||||||
|
connection = self.connect()
|
||||||
|
cursor = connection.cursor()
|
||||||
|
cursor.execute(query)
|
||||||
|
connection.commit()
|
||||||
|
connection.close()
|
||||||
|
|
||||||
|
def moveBookToApparat(self, book_id, appratat):
|
||||||
|
"""Move the book to the new apparat
|
||||||
|
|
||||||
|
Args:
|
||||||
|
book_id (int): the ID of the book
|
||||||
|
appratat (int): the ID of the new apparat
|
||||||
|
"""
|
||||||
|
# get book data
|
||||||
|
query = f"UPDATE media SET app_id = '{appratat}' WHERE id = '{book_id}'"
|
||||||
|
connection = self.connect()
|
||||||
|
cursor = connection.cursor()
|
||||||
|
cursor.execute(query)
|
||||||
|
connection.commit()
|
||||||
|
connection.close()
|
||||||
|
|
||||||
|
def getApparatNameByAppNr(self, appnr):
|
||||||
|
query = f"SELECT name FROM semesterapparat WHERE appnr = '{appnr}' and deletion_status = 0"
|
||||||
data = self.query_db(query)
|
data = self.query_db(query)
|
||||||
if data:
|
if data:
|
||||||
return data[0][0]
|
return data[0][0]
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ def generateSemesterByDate(next:bool = False):
|
|||||||
currentYear = datetime.datetime.now().year
|
currentYear = datetime.datetime.now().year
|
||||||
currentYear = int(str(currentYear)[-2:])
|
currentYear = int(str(currentYear)[-2:])
|
||||||
month = datetime.datetime.now().month
|
month = datetime.datetime.now().month
|
||||||
|
# month = month + 1
|
||||||
if next:
|
if next:
|
||||||
month += 1
|
month += 1
|
||||||
if month > 12:
|
if month > 12:
|
||||||
@@ -13,7 +14,7 @@ def generateSemesterByDate(next:bool = False):
|
|||||||
if month >= 4 and month <= 9:
|
if month >= 4 and month <= 9:
|
||||||
return "SoSe " + str(currentYear)
|
return "SoSe " + str(currentYear)
|
||||||
else:
|
else:
|
||||||
if month == 10 or month == 11:
|
if month == any([10, 11, 12]):
|
||||||
return f"WiSe {currentYear}/{currentYear+1}"
|
return f"WiSe {currentYear}/{currentYear+1}"
|
||||||
else:
|
else:
|
||||||
return f"WiSe {currentYear-1}/{currentYear}"
|
return f"WiSe {currentYear-1}/{currentYear}"
|
||||||
@@ -38,4 +39,8 @@ def generateSemesterByOffset(offset):
|
|||||||
else:
|
else:
|
||||||
return f"WiSe {currentYear+1}/{currentYear+2}"
|
return f"WiSe {currentYear+1}/{currentYear+2}"
|
||||||
else:
|
else:
|
||||||
return f"WiSe {currentYear+offset//2}/{currentYear+1+offset//2}"
|
return f"WiSe {currentYear+offset//2}/{currentYear+1+offset//2}"
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
print(generateSemesterByDate(next=True))
|
||||||
@@ -30,6 +30,11 @@ class Prof:
|
|||||||
setattr(self, "telnr", data[6])
|
setattr(self, "telnr", data[6])
|
||||||
return self
|
return self
|
||||||
|
|
||||||
|
def name(self, comma=False):
|
||||||
|
if comma:
|
||||||
|
return f"{self.lastname}, {self.firstname}"
|
||||||
|
return f"{self.lastname} {self.firstname}"
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class ApparatData:
|
class ApparatData:
|
||||||
|
|||||||
@@ -33,15 +33,11 @@ class AutoAdder(QThread):
|
|||||||
item = 0
|
item = 0
|
||||||
for entry in self.data:
|
for entry in self.data:
|
||||||
try:
|
try:
|
||||||
# webdata = WebRequest().get_ppn(entry).get_data()
|
|
||||||
# bd = BibTextTransformer("ARRAY").get_data(webdata).return_data()
|
|
||||||
# bd.signature = entry
|
|
||||||
self.updateSignal.emit(item)
|
self.updateSignal.emit(item)
|
||||||
self.setTextSignal.emit(entry)
|
self.setTextSignal.emit(entry)
|
||||||
# qsleep
|
|
||||||
item += 1
|
item += 1
|
||||||
self.progress.emit(item)
|
self.progress.emit(item)
|
||||||
# print(item, len(self.data))
|
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|||||||