-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
289 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import async from 'async'; | ||
const log = require('../log/clog'); | ||
import serviceUnavailable from '../error/serviceUnavailable'; | ||
import loadDeckUserStats from './loadDeckUserStats'; | ||
import loadDeckStatsByTime from './loadDeckStatsByTime'; | ||
|
||
|
||
export default function loadDeckStats(context, payload, done) { | ||
log.info(context); | ||
async.parallel([ | ||
(callback) => { | ||
context.executeAction(loadDeckStatsByTime, payload, callback); | ||
}, | ||
(callback) => { | ||
context.executeAction(loadDeckUserStats, payload, callback); | ||
}, | ||
], (err, results) => { | ||
if (err) { | ||
log.error(context, {filepath: __filename}); | ||
context.executeAction(serviceUnavailable, payload, done); | ||
return; | ||
} | ||
done(); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
const log = require('../log/clog'); | ||
import serviceUnavailable from '../error/serviceUnavailable'; | ||
import DeckStatsStore from '../../stores/DeckStatsStore'; | ||
|
||
|
||
export default function loadDeckStatsByTime(context, payload, done) { | ||
let datePeriod = context.getStore(DeckStatsStore).timelineFilters.datePeriod; | ||
let activityType = context.getStore(DeckStatsStore).timelineFilters.activityType; | ||
|
||
log.info(context); | ||
|
||
context.dispatch('SET_DECK_STATS_BY_TIME_LOADING'); | ||
|
||
context.service.read('stats.deckStatsByTime', {datePeriod, deckId: payload.deckId, activityType}, {timeout: 20 * 1000}, (err, res) => { | ||
if (err) { | ||
log.error(context, {filepath: __filename}); | ||
context.executeAction(serviceUnavailable, payload, done); | ||
} else { | ||
context.dispatch('LOAD_DECK_STATS_BY_TIME', {statsByTime: res}); | ||
} | ||
done(); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
const log = require('../log/clog'); | ||
import serviceUnavailable from '../error/serviceUnavailable'; | ||
import DeckStatsStore from '../../stores/DeckStatsStore'; | ||
|
||
|
||
export default function loadDeckUserStats(context, payload, done) { | ||
let datePeriod = context.getStore(DeckStatsStore).membersStatsFilters.datePeriod; | ||
let activityType = context.getStore(DeckStatsStore).membersStatsFilters.activityType; | ||
|
||
log.info(context); | ||
|
||
context.dispatch('SET_DECK_USER_STATS_LOADING'); | ||
|
||
context.service.read('stats.deckUserStats', {datePeriod, deckId: payload.deckId, activityType}, {timeout: 20 * 1000}, (err, res) => { | ||
if (err) { | ||
log.error(context, {filepath: __filename}); | ||
context.executeAction(serviceUnavailable, payload, done); | ||
} else { | ||
context.dispatch('LOAD_DECK_USER_STATS', {deckUserStats: res}); | ||
} | ||
done(); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import async from 'async'; | ||
const log = require('../log/clog'); | ||
import serviceUnavailable from '../error/serviceUnavailable'; | ||
import loadDeckStatsByTime from '../stats/loadDeckStatsByTime'; | ||
|
||
|
||
export default function updateDeckStatsActivityType(context, payload, done) { | ||
log.info(context); | ||
context.dispatch('UPDATE_DECK_ACTIVITY_TIMELINE_FILTERS', payload); | ||
|
||
async.parallel([ | ||
(callback) => { | ||
context.executeAction(loadDeckStatsByTime, payload, callback); | ||
}, | ||
], (err, results) => { | ||
if (err) { | ||
log.error(context, {filepath: __filename}); | ||
context.executeAction(serviceUnavailable, payload, done); | ||
return; | ||
} | ||
done(); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import async from 'async'; | ||
const log = require('../log/clog'); | ||
import serviceUnavailable from '../error/serviceUnavailable'; | ||
import loadDeckUserStats from '../stats/loadDeckUserStats'; | ||
|
||
|
||
export default function updateDeckUserStatsFilters(context, payload, done) { | ||
log.info(context); | ||
context.dispatch('UPDATE_DECK_USER_STATS_FILTERS', payload); | ||
|
||
async.parallel([ | ||
(callback) => { | ||
context.executeAction(loadDeckUserStats, payload, callback); | ||
}, | ||
], (err, results) => { | ||
if (err) { | ||
log.error(context, {filepath: __filename}); | ||
context.executeAction(serviceUnavailable, payload, done); | ||
return; | ||
} | ||
done(); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.