@@ -221,8 +221,8 @@ public async Task Execute()
221221 PlanText = planText ,
222222 PlanHours = parsedPlanHours ,
223223 SdkSitId = ( int ) site . MicrotingUid ! ,
224- CreatedByUserId = 1 ,
225- UpdatedByUserId = 1 ,
224+ CreatedByUserId = 0 ,
225+ UpdatedByUserId = 0 ,
226226 NettoHours = 0 ,
227227 PaiedOutFlex = 0 ,
228228 Pause1Id = 0 ,
@@ -263,40 +263,23 @@ public async Task Execute()
263263 }
264264
265265 planRegistration . PlanText = planText ;
266- // print to console if the current PlanHours is different from the one in the database
267- if ( planRegistration . PlanHours != parsedPlanHours )
268- {
269- Console . WriteLine (
270- $ "warn: PlanHours for site: { site . Name } and date: { dateValue } has changed from { planRegistration . PlanHours } to { parsedPlanHours } ") ;
271- }
272266
273- if ( ! planRegistration . PlanChangedByAdmin )
267+ if ( string . IsNullOrEmpty ( planRegistration . PlanText ) )
274268 {
275- planRegistration . PlanHours = parsedPlanHours ;
269+ // print to console if the current PlanHours is different from the one in the database
270+ if ( planRegistration . PlanHours != parsedPlanHours )
271+ {
272+ Console . WriteLine (
273+ $ "warn: PlanHours for site: { site . Name } and date: { dateValue } has changed from { planRegistration . PlanHours } to { parsedPlanHours } ") ;
274+ }
275+
276+ if ( ! planRegistration . PlanChangedByAdmin )
277+ {
278+ planRegistration . PlanHours = parsedPlanHours ;
279+ }
276280 }
277281
278- planRegistration . UpdatedByUserId = 1 ;
279-
280- // Commented out flex calculations to let UpdatePlanRegistration handle it
281- // if (preTimePlanning != null)
282- // {
283- // planRegistration.SumFlexStart = preTimePlanning.SumFlexEnd;
284- // planRegistration.SumFlexEnd =
285- // preTimePlanning.SumFlexEnd + planRegistration.PlanHours -
286- // planRegistration.NettoHours -
287- // planRegistration.PaiedOutFlex;
288- // planRegistration.Flex =
289- // planRegistration.NettoHours - planRegistration.PlanHours;
290- // }
291- // else
292- // {
293- // planRegistration.SumFlexEnd =
294- // planRegistration.PlanHours - planRegistration.NettoHours -
295- // planRegistration.PaiedOutFlex;
296- // planRegistration.SumFlexStart = 0;
297- // planRegistration.Flex =
298- // planRegistration.NettoHours - planRegistration.PlanHours;
299- // }
282+ planRegistration . UpdatedByUserId = 0 ;
300283
301284 await planRegistration . Update ( dbContext ) ;
302285 }
0 commit comments