Skip to content

Commit

Permalink
Merge pull request #213 from penguin-statistics/fix-personalmatrix
Browse files Browse the repository at this point in the history
fix(personalmatrix): fix personalmatrix not working
  • Loading branch information
AlvISsReimu authored Feb 27, 2020
2 parents 45ae40d + 8c61bc9 commit ff9562c
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 13 deletions.
4 changes: 2 additions & 2 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -449,9 +449,9 @@ export default {
logRouteEvent (newValue) {
if (newValue.name === "StatsByStage_Selected") {
// Console.log(this.$store.state.dataSource, newValue.params.stageId);
this.$ga.event('result', 'fetch_' + this.$store.state.dataSource, newValue.params.stageId, 1)
this.$ga.event('result', 'fetch_' + this.$store.getters['dataSource/source'], newValue.params.stageId, 1)
} else if (newValue.name === "StatsByItem_Selected") {
this.$ga.event('result', 'fetch_' + this.$store.state.dataSource, newValue.params.itemId, 1)
this.$ga.event('result', 'fetch_' + this.$store.getters['dataSource/source'], newValue.params.itemId, 1)
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/components/stats/DataSourceToggle.vue
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,10 @@ export default {
},
computed: {
...mapGetters('auth', ['loggedIn']),
...mapGetters('dataSource', ['source']),
dataSource: {
get() {
return this.$store.state.dataSource;
return this.source;
},
async set(value) {
switch (value) {
Expand Down
3 changes: 0 additions & 3 deletions src/store/modules/ajax.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ export default {
}
},
actions: {
// ajaxNewState(state, payload) {
// state.states.push(payload);
// },
_getOrCreateState ({commit, state}, id) {
let found = state.states.find(value => value.id === id);
if (found) {
Expand Down
11 changes: 8 additions & 3 deletions src/store/modules/dataSource.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
export default {
namespaced: true,
state: 'global',
state: {
source: 'global'
},
mutations: {
switchDataSource: (state, value) => {
state = value;
switch: (state, value) => {
state.source = value;
}
},
getters: {
source: state => state.source
}
};
2 changes: 1 addition & 1 deletion src/utils/Console.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Sentry from '@sentry/browser'
import * as Sentry from "@sentry/browser";

class Console {
static debug (...content) {
Expand Down
6 changes: 3 additions & 3 deletions src/utils/getters.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ Getters.limitations = {
}
Getters.statistics = {
byItemId(itemId) {
const stats = store.state.data[`${store.state.dataSource}Matrix`];
const stats = store.state.data[`${store.getters['dataSource/source']}Matrix`];
Console.debug(stats)
if (!stats) return [];
return stats.filter(el => {
return el.itemId === itemId
})
},
byStageId(stageId) {
const stats = store.state.data[`${store.state.dataSource}Matrix`];
const stats = store.state.data[`${store.getters['dataSource/source']}Matrix`];
Console.debug(stats)
if (!stats) return [];
return stats.filter(el => {
Expand Down Expand Up @@ -94,7 +94,7 @@ Getters.trends = {
return this.all() && this.all()[stageId];
},
all() {
if (store.state.dataSource !== 'global') {
if (store.getters['dataSource/source'] !== 'global') {
return null;
}
return store.state.data && store.state.data.trends && store.state.data.trends.results
Expand Down

1 comment on commit ff9562c

@vercel
Copy link

@vercel vercel bot commented on ff9562c Feb 27, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.