You are not logged in.

Announcement

 Téléchargez la dernière version stable de GLPI      -     Et vous, que pouvez vous faire pour le projet GLPI ? :  Contribuer
 Download last stable version of GLPI                      -     What can you do for GLPI ? :  Contribute

#1 2022-12-29 16:15:53

claugiral
Member
Registered: 2015-04-13
Posts: 55

auto_percent_done projects

Hello GLPI Team,

GLPI 9.5.6

I want to get the average of my projects automatically (In the main page of a project, the field percent done), from the tasks added to my project, a few years ago I did it including a trigger, I would like to know if now there is an automatically way to do that in the glpi interface or if I should do the same I did years ago modifying the code.

This was the trigger
This is my trigger:
delimiter $$
CREATE TRIGGER before_glpi_projecttasks_update
    AFTER UPDATE ON glpi_projecttasks
    FOR EACH ROW BEGIN
   
    declare cc int;
   
    select (sum(ifnull(percent_done,0)/100 * ifnull(planned_duration,0))/sum(ifnull(planned_duration,0)))*100
    into cc
    from glpi_projecttasks
    where projects_id=OLD.projects_id;
   
    update glpi_projects
    set percent_done= cc
    where id=OLD.projects_id;
   
END$$
delimiter ;


Thanks a lot,

Claudia

Offline

#2 2023-01-03 12:53:36

cconard96
Moderator
Registered: 2018-07-31
Posts: 2,813
Website

Re: auto_percent_done projects

In a Project or Project Task that you want to have its percent done field to be calculated, you can click the checkbox next to the Percent Done field. This will disable to field and automatically keep it updated any time sub-projects/tasks are added, updated or deleted.


GLPI Collaborator and Plugin Developer.
My non-English comments are automated translations. Sorry for any confusion that causes.
Mes commentaires non anglais sont des traductions automatiques. Désolé pour toute confusion qui cause.
Mis comentarios que no están en inglés son traducciones automáticas. Perdón por cualquier confusión que cause.

Offline

#3 2023-01-03 16:33:43

claugiral
Member
Registered: 2015-04-13
Posts: 55

Re: auto_percent_done projects

Thank you very much!!

Indeed, my vision is not very good and I could not see the checkbox to mark, but there it is! right next to the percent done box, with this information I close this topic smile

Offline

Board footer

Powered by FluxBB