mirror of
https://bitbucket.org/studiotem/jandl-taskmanager-app.git
synced 2026-10-21 06:20:21 +00:00
[Work hours] Changed minutes to float hours
This commit is contained in:
1 parent
8ab5e5b34d
commit
c38258ee1e
4 files changed
+28
-19
No files matched your search
@@ -116,7 +116,7 @@ export default {
|
|||||||
events.push({
|
events.push({
|
||||||
title: "Non working hours",
|
title: "Non working hours",
|
||||||
start: dayStart,
|
start: dayStart,
|
||||||
end: this._setMinutesToDate(employee.work_start, date),
|
end: this._setMinutesToDate(employee.work_start * 60, date),
|
||||||
type: 'non-working-hours',
|
type: 'non-working-hours',
|
||||||
split: i + 1,
|
split: i + 1,
|
||||||
draggable: false
|
draggable: false
|
||||||
@@ -124,7 +124,7 @@ export default {
|
|||||||
|
|
||||||
events.push({
|
events.push({
|
||||||
title: "Non working hours",
|
title: "Non working hours",
|
||||||
start: this._setMinutesToDate(employee.work_end, date),
|
start: this._setMinutesToDate(employee.work_end * 60, date),
|
||||||
end: dayEnd,
|
end: dayEnd,
|
||||||
type: 'non-working-hours',
|
type: 'non-working-hours',
|
||||||
split: i + 1,
|
split: i + 1,
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ export default {
|
|||||||
const schedulesCapacityBySplit = {}
|
const schedulesCapacityBySplit = {}
|
||||||
|
|
||||||
const now = moment()
|
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 => {
|
this.timelineData.tasks.forEach(task => {
|
||||||
if (task.type == 'non-working-hours' || task.subtask?.is_finished || task.blocker?.is_finished)
|
if (task.type == 'non-working-hours' || task.subtask?.is_finished || task.blocker?.is_finished)
|
||||||
@@ -85,8 +85,8 @@ export default {
|
|||||||
} else if (i == 1) {
|
} else if (i == 1) {
|
||||||
// Today
|
// Today
|
||||||
const elapsedMinutes = now.diff(now.clone().startOf('day'), 'minutes')
|
const elapsedMinutes = now.diff(now.clone().startOf('day'), 'minutes')
|
||||||
const workStart = this.user.work_start > elapsedMinutes ? this.user.workStart : elapsedMinutes
|
const workStart = this.user.work_start * 60 > elapsedMinutes ? this.user.workStart : elapsedMinutes
|
||||||
const todayCapacityMinutes = this.user.work_end - workStart
|
const todayCapacityMinutes = this.user.work_end * 60 - workStart
|
||||||
unscheduledTime = todayCapacityMinutes - schedulesCapacityBySplit[i + 1] < 0 ? 0 : todayCapacityMinutes - schedulesCapacityBySplit[i + 1]
|
unscheduledTime = todayCapacityMinutes - schedulesCapacityBySplit[i + 1] < 0 ? 0 : todayCapacityMinutes - schedulesCapacityBySplit[i + 1]
|
||||||
} else {
|
} else {
|
||||||
// Future
|
// Future
|
||||||
@@ -172,7 +172,7 @@ export default {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
const { subtasks, blockers } = await this.$axios.get_auth(`v1/subtasks?${queryParameters}`)
|
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.config.date = this.filter.start
|
||||||
this.subtasks = [...subtasks, ...blockers]
|
this.subtasks = [...subtasks, ...blockers]
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
@@ -58,20 +58,20 @@ export default {
|
|||||||
_generateNonWorking() {
|
_generateNonWorking() {
|
||||||
const nonWorkingHours = []
|
const nonWorkingHours = []
|
||||||
const date = new Date(this.filter.start)
|
const date = new Date(this.filter.start)
|
||||||
let earliestStartMinutes = null
|
let earliestHour = null
|
||||||
this.calendarConfig.date = date
|
this.calendarConfig.date = date
|
||||||
|
|
||||||
const { start: dayStart, end: dayEnd } = this._getDayStartEnd()
|
const { start: dayStart, end: dayEnd } = this._getDayStartEnd()
|
||||||
|
|
||||||
this.filter.team.employees.forEach((employee, index) => {
|
this.filter.team.employees.forEach((employee, index) => {
|
||||||
if (!earliestStartMinutes || (employee.work_start) < earliestStartMinutes)
|
if (!earliestHour || (employee.work_start) < earliestHour)
|
||||||
earliestStartMinutes = employee.work_start
|
earliestHour = employee.work_start
|
||||||
|
|
||||||
|
|
||||||
nonWorkingHours.push({
|
nonWorkingHours.push({
|
||||||
title: "Non working hours",
|
title: "Non working hours",
|
||||||
start: dayStart,
|
start: dayStart,
|
||||||
end: this._setMinutesToDate(employee.work_start),
|
end: this._setMinutesToDate(employee.work_start * 60),
|
||||||
split: index + 1,
|
split: index + 1,
|
||||||
type: 'non-working-hours',
|
type: 'non-working-hours',
|
||||||
draggable: false
|
draggable: false
|
||||||
@@ -79,7 +79,7 @@ export default {
|
|||||||
|
|
||||||
nonWorkingHours.push({
|
nonWorkingHours.push({
|
||||||
title: "Non working hours",
|
title: "Non working hours",
|
||||||
start: this._setMinutesToDate(employee.work_end),
|
start: this._setMinutesToDate(employee.work_end * 60),
|
||||||
end: dayEnd,
|
end: dayEnd,
|
||||||
split: index + 1,
|
split: index + 1,
|
||||||
type: 'non-working-hours',
|
type: 'non-working-hours',
|
||||||
@@ -87,7 +87,7 @@ export default {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
this.calendarConfig.scrollHour = (earliestStartMinutes) - 1
|
this.calendarConfig.scrollHour = (earliestHour) - 1
|
||||||
return nonWorkingHours
|
return nonWorkingHours
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -55,8 +55,8 @@ export default {
|
|||||||
|
|
||||||
const data = {
|
const data = {
|
||||||
id: this.user.id,
|
id: this.user.id,
|
||||||
work_start: parseFloat(sHours) * 60 + parseFloat(sMinutes),
|
work_start: parseFloat(sHours) + parseFloat(sMinutes) / 60,
|
||||||
work_end: parseFloat(eHours) * 60 + parseFloat(eMinutes)
|
work_end: parseFloat(eHours) + parseFloat(eMinutes) / 60
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -69,14 +69,23 @@ export default {
|
|||||||
|
|
||||||
_setDates() {
|
_setDates() {
|
||||||
this.form = {
|
this.form = {
|
||||||
work_start: this.minutesToTime(this.user.work_start),
|
work_start: this.decimalHoursToTime(this.user.work_start),
|
||||||
work_end: this.minutesToTime(this.user.work_end)
|
work_end: this.decimalHoursToTime(this.user.work_end)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
minutesToTime(minutes) {
|
// minutesToTime(minutes) {
|
||||||
var hours = Math.floor(minutes / 60)
|
// var hours = Math.floor(minutes / 60)
|
||||||
var mins = minutes % 60
|
// var mins = minutes % 60
|
||||||
|
// hours = (hours < 10 ? '0' : '') + hours
|
||||||
|
// mins = (mins < 10 ? '0' : '') + mins
|
||||||
|
|
||||||
|
// return hours + ':' + mins
|
||||||
|
// },
|
||||||
|
|
||||||
|
decimalHoursToTime(decimalHours) {
|
||||||
|
var hours = Math.floor(decimalHours)
|
||||||
|
var mins = Math.floor((decimalHours * 60) % 60)
|
||||||
hours = (hours < 10 ? '0' : '') + hours
|
hours = (hours < 10 ? '0' : '') + hours
|
||||||
mins = (mins < 10 ? '0' : '') + mins
|
mins = (mins < 10 ? '0' : '') + mins
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user