Fix: remove useless state

This commit is contained in:
Bertrand Benjamin 2021-08-09 09:17:11 +02:00
parent 791aa12d2d
commit 6188337140

View File

@ -102,11 +102,11 @@ const travail = {
getMonth: (state) => (date) => {
return state.months[date]
},
count: (state, getters) => {
count: (getters) => {
// Amount of mounts
return Object.keys(getters.months).length
},
ca: (state, getters) => {
ca: (getters) => {
// Total CA (ca_react if sets, ca_retro otherwise)
return Object.values(getters.months).map(a => monthCA(a)).reduce(
(acc, v) => acc + v,
@ -120,28 +120,28 @@ const travail = {
0
) / getters.count)
},
caTheo: (state, getters) => {
caTheo: (getters) => {
// Total theorical CA
return Object.values(getters.months).map(a => a.ca_theo).reduce(
(acc, v) => acc + v,
0
)
},
remuneration: (state, getters) => {
remuneration: (getters) => {
// Total remuneration
return Object.values(getters.months).map(a => a.remuneration).reduce(
(acc, v) => acc + v,
0
)
},
remunerationMean: (state, getters) => {
remunerationMean: (getters) => {
// Mean of remuneration
return Math.floor(Object.values(getters.months).map(a => a.remuneration).reduce(
(acc, v) => acc + v,
0
) / getters.count)
},
retrocession: (state, getters) => {
retrocession: (getters) => {
// Total retrocession
return Object.values(getters.months)
.map(a => a.retro)
@ -150,7 +150,7 @@ const travail = {
0
)
},
retrocessionMean: (state, getters) => {
retrocessionMean: (getters) => {
// Mean of retrocession
return Math.floor(
Object.values(getters.months)
@ -185,9 +185,7 @@ const travail = {
createMonth(context, { date, month }) {
// Create a new month
if (!(date in context.state.months)) {
console.log(date)
context.commit('createMonth', { date, month })
console.log(context.state.months)
} else {
console.log("This month already exists")
}