manioul / TeamTime

Web application to manage a team working on a recurrent shift (not necessarily weekly).
Other
1 stars 2 forks source link

Classes pas remplies correctement #5

Closed manioul closed 10 years ago

manioul commented 10 years ago

Lorsque l'on modifie les affectations, les classes ne sont pas modifiées.

manioul commented 10 years ago

commit 55fc9ea447bf2423b7168c73ecb82341780fffad Author: manioul webmaster@teamtime.me Date: Tue Jun 17 22:55:29 2014 +0200

getActiveUsersCell n'utilise plus des objets utilisateurGrille

La méthode getActiveUsersCell créait des objets utilisateurs pour ne
remplir qu'un petit tableau. Cette modification la rend beaucoup plus
efficace et moins gourmande.

Ce commit introduit une VIEW classes qui remplace TBL_CLASSES. Cela a l'avantage de garder dynamiquement à jour les classes des utilisateurs.

    DROP VIEW IF EXISTS classes;
    CREATE VIEW classes AS
            SELECT u.uid AS uid, nom, prenom, 'pc' AS `classe`, MIN(beginning) AS `beginning`, MAX(end) AS `end`, `poids`, `actif`
            FROM TBL_AFFECTATION AS c, TBL_USERS AS u
            WHERE u.uid = c.uid
            AND (grade = 'pc' OR grade = 'dtch' OR grade = 'fmp')
            AND `validated` IS TRUE
            GROUP BY u.uid
            UNION
            SELECT u.uid AS uid, nom, prenom, 'dtch' AS `classe`, MIN(beginning) AS `beginning`, MAX(end) AS `end`, `poids`, `actif`
            FROM TBL_AFFECTATION AS c, TBL_USERS AS u
            WHERE u.uid = c.uid
            AND grade = 'dtch'
            AND `validated` IS TRUE
            GROUP BY u.uid
            UNION
            SELECT u.uid AS uid, nom, prenom, 'fmp' AS `classe`, MIN(beginning) AS `beginning`, MAX(end) AS `end`, `poids`, `actif`
            FROM TBL_AFFECTATION AS c, TBL_USERS AS u 
            WHERE u.uid = c.uid
            AND grade = 'fmp'
            AND `validated` IS TRUE
            GROUP BY u.uid
            UNION
            SELECT u.uid AS uid, nom, prenom, 'ce' AS `classe`, MIN(beginning) AS `beginning`, MAX(end) AS `end`, `poids`, `actif`
            FROM TBL_AFFECTATION AS c, TBL_USERS AS u
            WHERE u.uid = c.uid
            AND grade = 'ce'
            AND `validated` IS TRUE
            GROUP BY u.uid
            UNION
            SELECT u.uid AS uid, nom, prenom, 'c' AS `classe`, MIN(beginning) AS `beginning`, MAX(end) AS `end`, `poids`, `actif`
            FROM TBL_AFFECTATION AS c, TBL_USERS AS u 
            WHERE u.uid = c.uid
            AND (grade = 'c' OR `grade` = 'theo')
            AND `validated` IS TRUE
            GROUP BY u.uid
            UNION
            SELECT u.uid AS uid, nom, prenom, 'cds' AS `classe`, MIN(beginning) AS `beginning`, MAX(end) AS `end`, `poids`, `actif`
            FROM TBL_AFFECTATION AS c, TBL_USERS AS u
            WHERE u.uid = c.uid
            AND grade = 'cds'
            AND `validated` IS TRUE
            GROUP BY u.uid;

Je laisse ouvert le temps de tester correctement...