Rebuild Times in Projects
Added Icons Rebuild Time Duration
This commit is contained in:
@@ -122,8 +122,35 @@ export const useDataStore = defineStore('data', {
|
||||
getOpenTasksCount: (state) => state.tasks.filter(task => task.categorie != "Erledigt").length,
|
||||
movementsBySpace: (state) => (spaceId:number) => state.movements.filter(move => move.spaceId === spaceId),
|
||||
getProductById: (state) => (productId:number) => state.products.find(product => product.id === productId),
|
||||
getProjectById: (state) => (projectId:number) => state.projects.find(project => project.id === projectId),
|
||||
getProjectById: (state) => (projectId:number) => {
|
||||
let project = state.projects.find(project => project.id === projectId)
|
||||
|
||||
let projectHours = 0
|
||||
|
||||
let projectTimes = state.times.filter(time => time.projectId === projectId)
|
||||
projectTimes.forEach(time => projectHours += time.duration)
|
||||
|
||||
project.projectHours = projectHours
|
||||
|
||||
return project
|
||||
|
||||
},
|
||||
getCustomerById: (state) => (customerId:number) => state.customers.find(customer => customer.id === customerId),
|
||||
getTimesByProjectId: (state) => (projectId:number) => {
|
||||
let times = state.times.filter(time => time.projectId === projectId)
|
||||
console.log(times.length)
|
||||
|
||||
/*const mapNumRange = (num, inMin, inMax, outMin, outMax) =>
|
||||
((num - inMin) * (outMax - outMin)) / (inMax - inMin) + outMin;
|
||||
|
||||
times.forEach((time,index) => {
|
||||
times[index].duration = Math.round(mapNumRange(Math.abs(new Date(time.end) - new Date(time.start))/1000/60,0,60,0,1)*100)/100
|
||||
|
||||
})*/
|
||||
|
||||
return times
|
||||
|
||||
},
|
||||
getFormSubmitsWithLabelProp: (state) => (state.formSubmits.map(submit => {return{...submit, label: submit.id}})),
|
||||
getResources: (state) => {
|
||||
return [
|
||||
|
||||
Reference in New Issue
Block a user