Commit 17a9de77 authored by Frank Bergmann's avatar Frank Bergmann

- added an update to im_projects when calculating the timesheet sum

  for normalization
parent 0a6407b0
...@@ -86,6 +86,7 @@ ad_proc -public im_timesheet2_sync_timesheet_costs { ...@@ -86,6 +86,7 @@ ad_proc -public im_timesheet2_sync_timesheet_costs {
h.cost_id is null h.cost_id is null
$user_sql $user_sql
$project_sql $project_sql
LIMIT 100
" "
set cost_ids [list] set cost_ids [list]
...@@ -473,27 +474,35 @@ ad_proc hours_sum { project_id {number_days ""} } { ...@@ -473,27 +474,35 @@ ad_proc hours_sum { project_id {number_days ""} } {
} }
set num [db_string hours_sum_for_group " set num [db_string hours_sum_for_group "
select select sum(hours)
sum(hours) from im_hours
from where
im_hours project_id in (
where select children.project_id
project_id in ( from im_projects parent,
select children.project_id im_projects children
from im_projects parent, where
im_projects children children.tree_sortkey between
where parent.tree_sortkey
children.tree_sortkey between and tree_right(parent.tree_sortkey)
parent.tree_sortkey and parent.project_id = :project_id
and tree_right(parent.tree_sortkey) UNION
and parent.project_id = :project_id select :project_id as project_id
UNION )
select :project_id as project_id
)
$days_back_sql $days_back_sql
"] "]
if {"" == $num} { set num 0 } if {"" == $num} { set num 0 }
# Update im_project reported_hours_cache
if {[empty_string_p $number_days]} {
db_dml update_project_reported_hours "
update im_projects
set reported_hours_cache = :num
where project_id = :project_id
"
}
return $num return $num
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment