Commit 1002c9947f588bfbd57f5d85cc93084bacae7d08
1 parent
40302c4f
Exists in
master
and in
4 other branches
Also feed ids from Lesia
Showing
2 changed files
with
6 additions
and
4 deletions
Show diff stats
app/commands/commands.py
@@ -43,27 +43,28 @@ def feed_from_lesia(): | @@ -43,27 +43,28 @@ def feed_from_lesia(): | ||
43 | lesia_periods = Base.classes.gestit_semestres | 43 | lesia_periods = Base.classes.gestit_semestres |
44 | 44 | ||
45 | lesia_session = Session(engine) | 45 | lesia_session = Session(engine) |
46 | + | ||
46 | agents = lesia_session.query(lesia_agent).all() | 47 | agents = lesia_session.query(lesia_agent).all() |
47 | for a in agents: | 48 | for a in agents: |
48 | - n_a = Agent(firstname=a.nom, secondname=a.prenom) | 49 | + n_a = Agent(id=a.IDagent, firstname=a.nom, secondname=a.prenom) |
49 | db.session.add(n_a) | 50 | db.session.add(n_a) |
50 | db.session.commit() | 51 | db.session.commit() |
51 | 52 | ||
52 | services = lesia_session.query(lesia_service).all() | 53 | services = lesia_session.query(lesia_service).all() |
53 | for s in services: | 54 | for s in services: |
54 | - n_s = Service(name=s.nom) | 55 | + n_s = Service(id=s.id, name=s.nom, abbr=s.abbreviation) |
55 | db.session.add(n_s) | 56 | db.session.add(n_s) |
56 | db.session.commit() | 57 | db.session.commit() |
57 | 58 | ||
58 | projects = lesia_session.query(lesia_project).all() | 59 | projects = lesia_session.query(lesia_project).all() |
59 | for p in projects: | 60 | for p in projects: |
60 | - n_p = Project(name=p.nom) | 61 | + n_p = Project(id=p.id, name=p.nom) |
61 | db.session.add(n_p) | 62 | db.session.add(n_p) |
62 | db.session.commit() | 63 | db.session.commit() |
63 | 64 | ||
64 | fonctions = lesia_session.query(lesia_fonction).all() | 65 | fonctions = lesia_session.query(lesia_fonction).all() |
65 | for f in fonctions: | 66 | for f in fonctions: |
66 | - n_c = Capacity(name=f.nom) | 67 | + n_c = Capacity(id=f.id, name=f.nom) |
67 | db.session.add(n_c) | 68 | db.session.add(n_c) |
68 | db.session.commit() | 69 | db.session.commit() |
69 | 70 |
app/models.py
@@ -17,6 +17,7 @@ class Project(db.Model): | @@ -17,6 +17,7 @@ class Project(db.Model): | ||
17 | class Service(db.Model): | 17 | class Service(db.Model): |
18 | id = db.Column(db.Integer, primary_key=True) | 18 | id = db.Column(db.Integer, primary_key=True) |
19 | name = db.Column(db.String(100), unique=True) | 19 | name = db.Column(db.String(100), unique=True) |
20 | + abbr = db.Column(db.String(50), unique=True) | ||
20 | 21 | ||
21 | 22 | ||
22 | class Function(db.Model): | 23 | class Function(db.Model): |