@@ -29,7 +29,9 @@ def get_day_statistic
29
29
SUM(ext_spend_hours.hours) AS ext_spend_hours,
30
30
SUM(int_spend_hours.hours) AS int_spend_hours
31
31
FROM users
32
- LEFT JOIN (SELECT *
32
+ LEFT JOIN (SELECT
33
+ time_entries.user_id as user_id,
34
+ SUM(time_entries.hours) as hours
33
35
FROM time_entries
34
36
WHERE spent_on = CURDATE()
35
37
AND time_entries.project_id IN (SELECT custom_values.customized_id
@@ -39,9 +41,12 @@ def get_day_statistic
39
41
WHERE custom_fields.type = 'ProjectCustomField' AND
40
42
custom_fields.name = #{ ActiveRecord ::Base . sanitize ( internal_project_attr ) } ) AND
41
43
custom_values.value != '1')
44
+ GROUP BY time_entries.user_id
42
45
) AS ext_spend_hours
43
46
ON users.id = ext_spend_hours.user_id
44
- LEFT JOIN (SELECT *
47
+ LEFT JOIN (SELECT
48
+ time_entries.user_id as user_id,
49
+ SUM(time_entries.hours) as hours
45
50
FROM time_entries
46
51
WHERE spent_on = CURDATE()
47
52
AND time_entries.project_id IN (SELECT custom_values.customized_id
@@ -51,6 +56,7 @@ def get_day_statistic
51
56
WHERE custom_fields.type = 'ProjectCustomField' AND
52
57
custom_fields.name = #{ ActiveRecord ::Base . sanitize ( internal_project_attr ) } ) AND
53
58
custom_values.value = '1')
59
+ GROUP BY time_entries.user_id
54
60
) AS int_spend_hours
55
61
ON users.id = int_spend_hours.user_id
56
62
WHERE users.id IN #{ str_arr }
0 commit comments