Commit 1002c9947f588bfbd57f5d85cc93084bacae7d08

Authored by hitier
1 parent 40302c4f

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 43 lesia_periods = Base.classes.gestit_semestres
44 44  
45 45 lesia_session = Session(engine)
  46 +
46 47 agents = lesia_session.query(lesia_agent).all()
47 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 50 db.session.add(n_a)
50 51 db.session.commit()
51 52  
52 53 services = lesia_session.query(lesia_service).all()
53 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 56 db.session.add(n_s)
56 57 db.session.commit()
57 58  
58 59 projects = lesia_session.query(lesia_project).all()
59 60 for p in projects:
60   - n_p = Project(name=p.nom)
  61 + n_p = Project(id=p.id, name=p.nom)
61 62 db.session.add(n_p)
62 63 db.session.commit()
63 64  
64 65 fonctions = lesia_session.query(lesia_fonction).all()
65 66 for f in fonctions:
66   - n_c = Capacity(name=f.nom)
  67 + n_c = Capacity(id=f.id, name=f.nom)
67 68 db.session.add(n_c)
68 69 db.session.commit()
69 70  
... ...
app/models.py
... ... @@ -17,6 +17,7 @@ class Project(db.Model):
17 17 class Service(db.Model):
18 18 id = db.Column(db.Integer, primary_key=True)
19 19 name = db.Column(db.String(100), unique=True)
  20 + abbr = db.Column(db.String(50), unique=True)
20 21  
21 22  
22 23 class Function(db.Model):
... ...