diff --git a/app/commands/commands.py b/app/commands/commands.py index 415c5d7..6ab4b6a 100644 --- a/app/commands/commands.py +++ b/app/commands/commands.py @@ -43,27 +43,28 @@ def feed_from_lesia(): lesia_periods = Base.classes.gestit_semestres lesia_session = Session(engine) + agents = lesia_session.query(lesia_agent).all() for a in agents: - n_a = Agent(firstname=a.nom, secondname=a.prenom) + n_a = Agent(id=a.IDagent, firstname=a.nom, secondname=a.prenom) db.session.add(n_a) db.session.commit() services = lesia_session.query(lesia_service).all() for s in services: - n_s = Service(name=s.nom) + n_s = Service(id=s.id, name=s.nom, abbr=s.abbreviation) db.session.add(n_s) db.session.commit() projects = lesia_session.query(lesia_project).all() for p in projects: - n_p = Project(name=p.nom) + n_p = Project(id=p.id, name=p.nom) db.session.add(n_p) db.session.commit() fonctions = lesia_session.query(lesia_fonction).all() for f in fonctions: - n_c = Capacity(name=f.nom) + n_c = Capacity(id=f.id, name=f.nom) db.session.add(n_c) db.session.commit() diff --git a/app/models.py b/app/models.py index 7b6c232..749e291 100644 --- a/app/models.py +++ b/app/models.py @@ -17,6 +17,7 @@ class Project(db.Model): class Service(db.Model): id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String(100), unique=True) + abbr = db.Column(db.String(50), unique=True) class Function(db.Model): -- libgit2 0.21.2