[Work hours] Changed minutes to float hours

This commit is contained in:
Matej Glasnák committed 2023-04-12 13:47:46 +02:00
1 parent 8ab5e5b34d
commit c38258ee1e
4 files changed
+28 -19

No files matched your search

@@ -116,7 +116,7 @@ export default {
events.push({
title: "Non working hours",
start: dayStart,
end: this._setMinutesToDate(employee.work_start, date),
end: this._setMinutesToDate(employee.work_start * 60, date),
type: 'non-working-hours',
split: i + 1,
draggable: false
@@ -124,7 +124,7 @@ export default {
events.push({
title: "Non working hours",
start: this._setMinutesToDate(employee.work_end, date),
start: this._setMinutesToDate(employee.work_end * 60, date),
end: dayEnd,
type: 'non-working-hours',
split: i + 1,
+4 -4
View File
@@ -41,7 +41,7 @@ export default {
const schedulesCapacityBySplit = {}
const now = moment()
const dailyCapacityMinutes = this.user.work_end - this.user.work_start
const dailyCapacityMinutes = (this.user.work_end - this.user.work_start) * 60
this.timelineData.tasks.forEach(task => {
if (task.type == 'non-working-hours' || task.subtask?.is_finished || task.blocker?.is_finished)
@@ -85,8 +85,8 @@ export default {
} else if (i == 1) {
// Today
const elapsedMinutes = now.diff(now.clone().startOf('day'), 'minutes')
const workStart = this.user.work_start > elapsedMinutes ? this.user.workStart : elapsedMinutes
const todayCapacityMinutes = this.user.work_end - workStart
const workStart = this.user.work_start * 60 > elapsedMinutes ? this.user.workStart : elapsedMinutes
const todayCapacityMinutes = this.user.work_end * 60 - workStart
unscheduledTime = todayCapacityMinutes - schedulesCapacityBySplit[i + 1] < 0 ? 0 : todayCapacityMinutes - schedulesCapacityBySplit[i + 1]
} else {
// Future
@@ -172,7 +172,7 @@ export default {
try {
const { subtasks, blockers } = await this.$axios.get_auth(`v1/subtasks?${queryParameters}`)
this.config.scrollHour = (this.filter?.employee.work_start / 60) - 1
this.config.scrollHour = (this.filter?.employee.work_start) - 1
this.config.date = this.filter.start
this.subtasks = [...subtasks, ...blockers]
} catch (error) {
@@ -58,20 +58,20 @@ export default {
_generateNonWorking() {
const nonWorkingHours = []
const date = new Date(this.filter.start)
let earliestStartMinutes = null
let earliestHour = null
this.calendarConfig.date = date
const { start: dayStart, end: dayEnd } = this._getDayStartEnd()
this.filter.team.employees.forEach((employee, index) => {
if (!earliestStartMinutes || (employee.work_start) < earliestStartMinutes)
earliestStartMinutes = employee.work_start
if (!earliestHour || (employee.work_start) < earliestHour)
earliestHour = employee.work_start
nonWorkingHours.push({
title: "Non working hours",
start: dayStart,
end: this._setMinutesToDate(employee.work_start),
end: this._setMinutesToDate(employee.work_start * 60),
split: index + 1,
type: 'non-working-hours',
draggable: false
@@ -79,7 +79,7 @@ export default {
nonWorkingHours.push({
title: "Non working hours",
start: this._setMinutesToDate(employee.work_end),
start: this._setMinutesToDate(employee.work_end * 60),
end: dayEnd,
split: index + 1,
type: 'non-working-hours',
@@ -87,7 +87,7 @@ export default {
})
})
this.calendarConfig.scrollHour = (earliestStartMinutes) - 1
this.calendarConfig.scrollHour = (earliestHour) - 1
return nonWorkingHours
},