Fix: linting
This commit is contained in:
parent
7fc1675052
commit
6a091efea6
@ -49,7 +49,6 @@ export default {
|
||||
var rows = []
|
||||
if (t === 'sans tags') {
|
||||
rows = this.tag_filter_rows([], true, false)
|
||||
console.log(rows)
|
||||
} else {
|
||||
rows = this.tag_filter_rows([t], false, false)
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ export function total (rows, field = 'Montant') {
|
||||
return Math.round(sum)
|
||||
}
|
||||
|
||||
export function tag_filter (rows, tags, invert=false) {
|
||||
export function tagFilter (rows, tags, invert = false) {
|
||||
// filter rows by tags
|
||||
// invert inverts the selection
|
||||
return rows.filter(row => {
|
||||
@ -55,7 +55,7 @@ export function tag_filter (rows, tags, invert=false) {
|
||||
|
||||
function objectMap (object, mapFn) {
|
||||
// map a function on object value
|
||||
return Object.keys(object).reduce(function(result, key) {
|
||||
return Object.keys(object).reduce((result, key) => {
|
||||
result[key] = mapFn(object[key])
|
||||
return result
|
||||
}, {})
|
||||
|
@ -3,26 +3,27 @@ import Vue from 'vue'
|
||||
import path from 'path'
|
||||
import Papa from 'papaparse'
|
||||
import moment from 'moment'
|
||||
import { appendTag, formatDate, tag_filter } from '../../libs/data_processing'
|
||||
import { appendTag, formatDate, tagFilter } from '../../libs/data_processing'
|
||||
|
||||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
csv: {},
|
||||
month: moment(),
|
||||
month: moment()
|
||||
},
|
||||
getters: {
|
||||
csvs: (state) => {
|
||||
// return array of csv filename
|
||||
return Object.values(state.csv).sort((a, b) => {
|
||||
var filenameA=a.filename.toLowerCase(), filenameB=b.filename.toLowerCase()
|
||||
var filenameA = a.filename.toLowerCase()
|
||||
var filenameB = b.filename.toLowerCase()
|
||||
if (filenameA < filenameB) {
|
||||
return -1
|
||||
}
|
||||
if (filenameA > filenameB) {
|
||||
return 1
|
||||
}
|
||||
return 0
|
||||
return 0
|
||||
})
|
||||
},
|
||||
rows: (state) => {
|
||||
@ -68,11 +69,11 @@ export default {
|
||||
rows = getters.spending_rows
|
||||
}
|
||||
if (tags.length > 0) {
|
||||
return tag_filter(rows, tags, invert)
|
||||
return tagFilter(rows, tags, invert)
|
||||
} else {
|
||||
if (invert) {
|
||||
return rows.filter(r => {
|
||||
return r.tags.map(t => t.name.toLowerCase()).toString() === ["cb"].toString()
|
||||
return r.tags.map(t => t.name.toLowerCase()).toString() === ['cb'].toString()
|
||||
})
|
||||
} else {
|
||||
return rows
|
||||
@ -100,7 +101,7 @@ export default {
|
||||
},
|
||||
months: (state, getters) => {
|
||||
// Set of month
|
||||
return [... new Set(getters.rows.map(x => moment(x.Date).format('MMMM YYYY')))]
|
||||
return [...new Set(getters.rows.map(x => moment(x.Date).format('MMMM YYYY')))]
|
||||
}
|
||||
|
||||
},
|
||||
@ -175,6 +176,6 @@ export default {
|
||||
prev_month (context) {
|
||||
var prev = moment(context.getters.month).subtract(1, 'months')
|
||||
context.commit('SET_MONTH', { month: prev })
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user