示例#1
0
def get_competence_grid(request, contractor_id, deadline_id):
    """
    Return a competence grid record for the given user and deadline
    """
    query = CompetenceGrid.query()
    query = query.filter_by(
        contractor_id=contractor_id,
        deadline_id=deadline_id,
    )

    grid = query.first()
    options = CompetenceOption.query()

    if grid is None:
        grid = CompetenceGrid(
            contractor_id=contractor_id,
            deadline_id=deadline_id,
        )

        request.dbsession.add(grid)

    for option in options:
        grid.ensure_item(option)

    return grid
示例#2
0
def get_competence_grid(request, contractor_id, deadline_id):
    """
    Return a competence grid record for the given user and deadline
    """
    query = CompetenceGrid.query()
    query = query.filter_by(
        contractor_id=contractor_id,
        deadline_id=deadline_id,
    )

    grid = query.first()
    options = CompetenceOption.query()

    if grid is None:
        grid = CompetenceGrid(
            contractor_id=contractor_id,
            deadline_id=deadline_id,
        )

        request.dbsession.add(grid)

    for option in options:
        grid.ensure_item(option)

    return grid
示例#3
0
    def before(self, form):
        if CompetenceScale.query().count() == 0:
            self.session.flash(u"Les barêmes doivent être configurer avant \
la grille de compétences.")
            raise HTTPFound(self.request.route_path("admin_competence_scale"))
        if CompetenceOption.query().count() == 0:
            self.session.flash(
                u"La grille de compétence doit être configurée avant les \
barêmes")
            raise HTTPFound(self.request.route_path("admin_competence_option"))
        req_admin_class.before(self, form)
示例#4
0
    def before(self, form):
        if CompetenceScale.query().count() == 0:
            self.session.flash(u"Les barêmes doivent être configurés avant \
la grille de compétences.")
            raise HTTPFound(
                self.request.route_path(
                    os.path.join(COMPETENCE_URL, "competence_scale")))
        if CompetenceOption.query().count() == 0:
            self.session.flash(
                u"La grille de compétence doit être configurée avant les \
barêmes")
            raise HTTPFound(self.request.route_path("admin_competence_option"))
        BaseCompetenceRequirementView.before(self, form)
示例#5
0
    def before(self, form):
        if CompetenceScale.query().count() == 0:
            self.session.flash(
                u"Les barêmes doivent être configurer avant \
la grille de compétences."
            )
            raise HTTPFound(self.request.route_path("admin_competence_scale"))
        if CompetenceOption.query().count() == 0:
            self.session.flash(
                u"La grille de compétence doit être configurée avant les \
barêmes"
            )
            raise HTTPFound(self.request.route_path("admin_competence_option"))
        req_admin_class.before(self, form)
示例#6
0
    def before(self, form):
        if CompetenceScale.query().count() == 0:
            self.session.flash(
                u"Les barêmes doivent être configurés avant \
la grille de compétences."
            )
            raise HTTPFound(
                self.request.route_path(
                    os.path.join(COMPETENCE_URL, "competence_scale")
                )
            )
        if CompetenceOption.query().count() == 0:
            self.session.flash(
                u"La grille de compétence doit être configurée avant les \
barêmes"
            )
            raise HTTPFound(self.request.route_path("admin_competence_option"))
        BaseCompetenceRequirementView.before(self, form)
示例#7
0
 def get_appstruct(self):
     """
     Return the appstruct for competence requirements configuration
     """
     options = CompetenceOption.query().all()
     appstruct = []
     for option in options:
         opt_appstruct = {
             "id": option.id,
             "label": option.label,
             "requirements": []
         }
         for deadline in CompetenceDeadline.query():
             opt_appstruct['requirements'].append(
                 {
                     'deadline_id': deadline.id,
                     "deadline_label": deadline.label,
                     'requirement': option.get_requirement(deadline.id)
                 }
             )
         appstruct.append(opt_appstruct)
     return {'datas': appstruct}