diff --git a/src/components/graph_time.vue b/src/components/graph_time.vue index 0dd98cc..9484cd7 100644 --- a/src/components/graph_time.vue +++ b/src/components/graph_time.vue @@ -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) } diff --git a/src/libs/data_processing.js b/src/libs/data_processing.js index ccb7e16..9c4217e 100644 --- a/src/libs/data_processing.js +++ b/src/libs/data_processing.js @@ -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 }, {}) diff --git a/src/store/modules/datas.js b/src/store/modules/datas.js index de99c4c..22fcb37 100644 --- a/src/store/modules/datas.js +++ b/src/store/modules/datas.js @@ -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 }) - }, + } } }