@@ -117,6 +117,18 @@ class OrderBoardTest < ActiveSupport::TestCase
117
117
assert_equal 16 , board . total_row_planned_hours ( employees ( :lucien ) . id , work_items ( :hitobito_demo_app ) . id )
118
118
end
119
119
120
+ test '#total_row_planned_hours includes plannings from only the active period if the respective flag is set' do
121
+ create_plannings
122
+ Planning . create! ( work_item_id : work_items ( :hitobito_demo_app ) . id ,
123
+ employee_id : employees ( :lucien ) . id ,
124
+ date : date - 28 . days ,
125
+ percent : 100 )
126
+
127
+ board = Plannings ::OrderBoard . new ( order , period )
128
+
129
+ assert_equal 8 , board . total_row_planned_hours ( employees ( :lucien ) . id , work_items ( :hitobito_demo_app ) . id , true )
130
+ end
131
+
120
132
test '#total_post_planned_hours includes plannings for all employees, even if only some are included' do
121
133
create_plannings
122
134
board = Plannings ::OrderBoard . new ( order , period )
@@ -144,6 +156,16 @@ class OrderBoardTest < ActiveSupport::TestCase
144
156
assert_equal 24 , board . total_planned_hours
145
157
end
146
158
159
+ test '#total_planned_hours are calculated for entire timespan or only the active period, depending on the passed flag' do
160
+ create_plannings
161
+
162
+ board = Plannings ::OrderBoard . new ( order , period )
163
+ board . for_rows ( [ [ employees ( :lucien ) . id , work_items ( :hitobito_demo_app ) . id ] ] )
164
+
165
+ assert_equal 24 , board . total_planned_hours ( false )
166
+ assert_equal 20 , board . total_planned_hours ( true )
167
+ end
168
+
147
169
private
148
170
149
171
def period
0 commit comments