0
Fork 0
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:
Barno 2023-03-02 11:28:36 +03:00 committed by GitHub
parent dc98868961
commit 389362f463
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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
};
}
}