Commit 48c6f9a0b93d82397ac8499c666a62d0c82b5171

Authored by hitier
1 parent 0f1c3228

Added skills

app/commands/commands.py
... ... @@ -11,7 +11,7 @@ from sqlalchemy.exc import IntegrityError
11 11 from sqlalchemy.sql import func
12 12  
13 13 from app.models import db, Agent, Service, Project, Capacity, Period, Charge, AgentStatus, Company, AgentBap, \
14   - AgentGrade, Category, Label, ProjectLabel, CategoryLabel, AgentHistory, AgentResponsability
  14 + AgentGrade, Category, Label, ProjectLabel, CategoryLabel, AgentHistory, AgentResponsability, AgentSkill
15 15 # TODO: rename to methods and add get_roles()
16 16 from app.auth.models import User, _nameToRole, _roleToName
17 17  
... ... @@ -38,6 +38,21 @@ def feed_statical():
38 38 db.session.add(n_ar)
39 39 db.session.commit()
40 40  
  41 + skills = ["AIT", "AIT Optique", "Assistant Prévention & Sécurité", "Assistant Prévention & Sécurité",
  42 + "Assistant Prévention et Sécurité", "Assurance produit", "Automatismes", "C", "C++", "chef de service",
  43 + "Configuration FPGA", "cryogénie", "CSS", "détection fuite Hélium", "Electronique",
  44 + "Electronique AIT/AIV", "essais en environnement", "essais vide-thermique", "Excel",
  45 + "fabrication mécanique", "FPGA", "Gestion de projet", "graphisme", "Haskell", "HTML", "IDL",
  46 + "instrumentation spatiale", "Java", "Javascript", "LabView", "Latex", "logiciels embarqués",
  47 + "Machine Learning", "mécanique BE", "optique instrumentale", "optronique", "photographie", "Photoshop",
  48 + "PHP", "Powerpoint", "Pro du café", "processeurs LEON", "Python", "Qualité système", "Ruby",
  49 + "Ruby on Rails", "Scrum", "SpaceWire", "temps-réel", "Vide", "Word"]
  50 +
  51 + for s in skills:
  52 + n_as = AgentSkill(name=s)
  53 + db.session.add(n_as)
  54 + db.session.commit()
  55 +
41 56  
42 57 @bp.cli.command('feed_default')
43 58 def feed_default():
... ...
app/main/routes.py
... ... @@ -7,7 +7,7 @@ from flask_login import login_required, current_user
7 7 from . import bp
8 8  
9 9 from app.models import Agent, Project, Service, Capacity, Period, db, Company, AgentGrade, AgentStatus, AgentBap, \
10   - Charge, Category, Label, AgentResponsability
  10 + Charge, Category, Label, AgentResponsability, AgentSkill
11 11 from app import db_mgr
12 12 from app.auth.routes import role_required
13 13  
... ... @@ -93,6 +93,17 @@ def responsabilities():
93 93 responsabilities=all_resp)
94 94  
95 95  
  96 +@bp.route('/skills')
  97 +@login_required
  98 +def skills():
  99 + # get skills list
  100 + all_skills = AgentSkill.query.order_by(AgentSkill.name).all()
  101 + num_skills = len(all_skills)
  102 + # pass to template
  103 + return render_template('skills.html', subtitle="Liste des fonctions ({})".format(num_skills),
  104 + skills=all_skills)
  105 +
  106 +
96 107 @bp.route('/capacities')
97 108 @login_required
98 109 def capacities():
... ...
app/main/templates/skills.html 0 → 100644
... ... @@ -0,0 +1,21 @@
  1 +{% extends "base_page.html" %}
  2 +{% block content %}
  3 +
  4 + <!-- Invisible span to definte wich ul and a in the navbar are actived -->
  5 + <span id="nav_actived" style="display: none">agent,skills</span>
  6 +
  7 + <table class="table_datatables table table-hover">
  8 + <thead>
  9 + <tr>
  10 + <th scope="col">Compétences</th>
  11 + </tr>
  12 + </thead>
  13 + <tbody>
  14 + {% for s in skills %}
  15 + <tr>
  16 + <td>{{ s.name }}</td>
  17 + </tr>
  18 + {% endfor %}
  19 + </tbody>
  20 + </table>
  21 +{% endblock %}
... ...
app/models.py
... ... @@ -221,6 +221,12 @@ class AgentHistory(db.Model):
221 221 # Agents
222 222 #
223 223  
  224 +class AgentSkill(db.Model):
  225 + id = db.Column(db.Integer, primary_key=True)
  226 + name = db.Column(db.String(100), unique=True)
  227 + abbr = db.Column(db.String(50), unique=True)
  228 +
  229 +
224 230 class AgentResponsability(db.Model):
225 231 id = db.Column(db.Integer, primary_key=True)
226 232 name = db.Column(db.String(100), unique=True)
... ...
app/templates/base_page.html
... ... @@ -58,7 +58,8 @@
58 58 href="{{ url_for('main.capacities') }}">Liste des
59 59 fonctions</a>
60 60 </li>
61   - <li class="nav-item"><a class="sub_link nav-link disabled" href="#">Liste des compétences</a></li>
  61 + <li class="nav-item"><a id="skills" class="sub_link nav-link"
  62 + href="{{ url_for('main.skills') }}">Liste des compétences</a></li>
62 63 <li class="nav-item"><a class="sub_link nav-link disabled" href="#">Liste des pôles</a></li>
63 64 <li class="nav-item"><a class="sub_link nav-link disabled" href="#">Liste des emplois types</a></li>
64 65 </ul>
... ...