File tree Expand file tree Collapse file tree 2 files changed +12
-8
lines changed
screens/hours/components/TotalHours Expand file tree Collapse file tree 2 files changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -90,13 +90,12 @@ export function getTime(date: Date | undefined) {
9090 return format ( date , TIME_FORMAT ) ;
9191}
9292
93- export const EIGHT_HOURS = 8 * 60 * 60 * 1000 ;
94-
9593export function estimateWorkingTimeEnd (
9694 startDate : Date | undefined ,
97- restTimeMs : number
95+ restTimeMs : number ,
96+ workingHoursMs : number
9897) : Date | undefined {
9998 return startDate
100- ? new Date ( startDate . getTime ( ) + restTimeMs + EIGHT_HOURS )
99+ ? new Date ( startDate . getTime ( ) + restTimeMs + workingHoursMs )
101100 : undefined ;
102101}
Original file line number Diff line number Diff line change @@ -3,29 +3,34 @@ import { observer } from 'mobx-react';
33import { Space } from 'antd' ;
44
55import * as TaskHooks from '../../../../hooks/TaskHooks' ;
6- import TaskTimeItemModel from '../../../../models/TaskTimeItemModel' ;
6+ import TaskTimeItemModel from '../../../../modules/tasks/ models/TaskTimeItemModel' ;
77import {
8- EIGHT_HOURS ,
98 estimateWorkingTimeEnd ,
109 getTime ,
1110 msToTime ,
1211} from '../../../../helpers/DateTime' ;
1312import LabelWithTooltip , { ILabelWithTooltipProps } from './LabelWithTooltip' ;
13+ import rootStore from '../../../../modules/RootStore' ;
1414
1515interface TotalHoursProps {
1616 timeItems : TaskTimeItemModel [ ] ;
1717}
1818
19+ const { settingsStore } = rootStore ;
20+
1921const TotalHours = observer ( ( props : TotalHoursProps ) => {
2022 const { timeItems } = props ;
23+ const { settings } = settingsStore ;
24+ const workingHoursMs = settings . numberOfWorkingHours ;
2125
2226 const { durationMs, restMs } = TaskHooks . useTimeItemsDuration ( timeItems ) ;
2327 const startWorkingTime = TaskHooks . useStartWorkingTime ( timeItems ) ;
2428 const estimatedWorkingTimeEnd = estimateWorkingTimeEnd (
2529 startWorkingTime ,
26- restMs
30+ restMs ,
31+ workingHoursMs
2732 ) ;
28- const restHoursMs = EIGHT_HOURS - durationMs ;
33+ const restHoursMs = workingHoursMs - durationMs ;
2934
3035 if ( ! timeItems . length ) {
3136 return null ;
You can’t perform that action at this time.
0 commit comments