From b9369bf4725addaeed33ca3e4ffbac9dcce58c5e Mon Sep 17 00:00:00 2001 From: Yeganathan S Date: Fri, 21 Apr 2023 15:27:01 +0530 Subject: [PATCH 1/3] fix: activities of active members change based on the time frame selection --- .../src/modules/dashboard/store/actions.js | 48 +++++-------------- 1 file changed, 13 insertions(+), 35 deletions(-) diff --git a/frontend/src/modules/dashboard/store/actions.js b/frontend/src/modules/dashboard/store/actions.js index 65400fc6f8..b08c36f159 100644 --- a/frontend/src/modules/dashboard/store/actions.js +++ b/frontend/src/modules/dashboard/store/actions.js @@ -157,41 +157,19 @@ export default { async getActiveMembers({ commit, state }) { const { platform, period } = state.filters; state.members.loadingActive = true; - return MemberService.list( - { - and: [ - { - lastActive: { - gte: moment() - .startOf('day') - .subtract( - period.granularity === 'day' - ? period.value - 1 - : period.value, - period.granularity, - ) - .toISOString(), - }, - isTeamMember: { - not: true, - }, - }, - ...(platform !== 'all' - ? [ - { - activeOn: { - contains: [platform], - }, - }, - ] - : []), - ], - }, - 'activityCount_DESC', - 5, - 0, - false, - ) + return MemberService.listActive({ + platform: platform !== 'all' ? platform : [], + isTeamMember: false, + activityIsContribution: null, + activityTimestampFrom: moment() + .utc() + .subtract(period.value, period.granularity) + .toISOString(), + activityTimestampTo: moment().utc(), + orderBy: 'activeDaysCount_DESC', + offset: 0, + limit: 5, + }) .then((data) => { commit('SET_ACTIVE_MEMBERS', data); return Promise.resolve(data); From d6134118e25be4f3de420c4f9581e0fdec3d03ca Mon Sep 17 00:00:00 2001 From: Yeganathan S Date: Fri, 21 Apr 2023 16:23:26 +0530 Subject: [PATCH 2/3] change orderBy from activeDaysCount_DESC to activityCount_DESC --- frontend/src/modules/dashboard/store/actions.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/modules/dashboard/store/actions.js b/frontend/src/modules/dashboard/store/actions.js index b08c36f159..8eed8d0258 100644 --- a/frontend/src/modules/dashboard/store/actions.js +++ b/frontend/src/modules/dashboard/store/actions.js @@ -166,7 +166,7 @@ export default { .subtract(period.value, period.granularity) .toISOString(), activityTimestampTo: moment().utc(), - orderBy: 'activeDaysCount_DESC', + orderBy: 'activityCount_DESC', offset: 0, limit: 5, }) From d0ed75f490ef8f6df520129336396215bc577842 Mon Sep 17 00:00:00 2001 From: Yeganathan S Date: Fri, 21 Apr 2023 22:11:23 +0530 Subject: [PATCH 3/3] fix: platform filter by passing it as array of objects --- frontend/src/modules/dashboard/store/actions.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/modules/dashboard/store/actions.js b/frontend/src/modules/dashboard/store/actions.js index 8eed8d0258..ab24e15472 100644 --- a/frontend/src/modules/dashboard/store/actions.js +++ b/frontend/src/modules/dashboard/store/actions.js @@ -158,7 +158,7 @@ export default { const { platform, period } = state.filters; state.members.loadingActive = true; return MemberService.listActive({ - platform: platform !== 'all' ? platform : [], + platform: platform !== 'all' ? [{ value: platform }] : [], isTeamMember: false, activityIsContribution: null, activityTimestampFrom: moment()