mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-20 22:42:53 -05:00
Replaced Promise.props()
function with .all()
in Members stats
refs https://github.com/TryGhost/Ghost/issues/14882 - this helps remove uses of Bluebird within Ghost Co-authored-by: Carol-Barno <cbarno@innovexsolutions.co.ke>
This commit is contained in:
parent
dc98868961
commit
389362f463
1 changed files with 12 additions and 8 deletions
|
@ -1,5 +1,4 @@
|
|||
const moment = require('moment-timezone');
|
||||
const Promise = require('bluebird');
|
||||
|
||||
const dateFormat = 'YYYY-MM-DD HH:mm:ss';
|
||||
class MembersStats {
|
||||
|
@ -131,14 +130,19 @@ class MembersStats {
|
|||
const totalMembers = await this.getTotalMembers();
|
||||
|
||||
// perform final calculations in parallel
|
||||
const results = await Promise.props({
|
||||
total: totalMembers,
|
||||
total_in_range: this.getTotalMembersInRange({days, totalMembers, siteTimezone}),
|
||||
total_on_date: this.getTotalMembersOnDatesInRange({days, totalMembers, siteTimezone}),
|
||||
new_today: this.getNewMembersToday({siteTimezone})
|
||||
});
|
||||
const [total, totalInRange, totalOnDate, newToday] = await Promise.all([
|
||||
totalMembers,
|
||||
this.getTotalMembersInRange({days, totalMembers, siteTimezone}),
|
||||
this.getTotalMembersOnDatesInRange({days, totalMembers, siteTimezone}),
|
||||
this.getNewMembersToday({siteTimezone})
|
||||
]);
|
||||
|
||||
return results;
|
||||
return {
|
||||
total,
|
||||
total_in_range: totalInRange,
|
||||
total_on_date: totalOnDate,
|
||||
new_today: newToday
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue