Project

General

Profile

How can update automatic?

Added by Ismael Fernandes Pires about 6 years ago

Good Afternoon, i need some help here..
So, i made a query to get some values of the time entries of the issues.
Here, we have some activitys to register the time worked. Like:
- Development
- Test
- Support
- Analyze

This is the query i made to get this values:

TimeEntry.find_by_sql("select     a.id, 
        a.project_id,
        a.user_id,    
        sum(a.hours) as hours, 
        a.comments,
        a.activity_id,
        a.spent_on,
        a.tyear,
        a.tmonth,
        a.tweek,
        a.created_on,
        a.updated_on
        from (
select te.*
from custom_values cv 
    inner join custom_fields cf
        on cv.custom_field_id = cf.id
    inner join time_entries te
        on te.issue_id = cv.customized_id
    inner join enumerations en
        on en.id = te.activity_id
where cv.customized_id = '#{id}' and en.name = 'Development'
group by issue_id, hours) as a" )[0][:hours]

Returns like that:

My problem is: This fields just update when i go to Edit and submit, not when a put some hours in theirs respectives activitys.

Thats the problem.. I need a solution to update this automatic.. Maybe a workflow? I dont know.. Some one could help me?