Show pending performance groups before maturity
This commit is contained in:
1 parent
55a6774daf
commit
ca59ba0f1f
5 files changed
+90
-9
No files matched your search
@@ -733,7 +733,7 @@ export class MessagesRepository {
|
||||
.map((row) => [row.strategy_id, row.total]),
|
||||
);
|
||||
|
||||
return rows.map(row => performanceStats(
|
||||
const results = rows.map(row => performanceStats(
|
||||
{
|
||||
strategyId: row.strategy_id as string,
|
||||
totalSent: row.total_sent as number,
|
||||
@@ -742,6 +742,17 @@ export class MessagesRepository {
|
||||
},
|
||||
matureBefore === undefined ? undefined : pending.get(row.strategy_id as string) ?? 0,
|
||||
));
|
||||
const matureStrategies = new Set(rows.map((row) => row.strategy_id as string));
|
||||
for (const [strategyId, pendingSent] of pending) {
|
||||
if (matureStrategies.has(strategyId)) continue;
|
||||
results.push(performanceStats({
|
||||
strategyId,
|
||||
totalSent: 0,
|
||||
totalResponses: 0,
|
||||
totalImages: 0,
|
||||
}, pendingSent));
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
getSubredditStats(matureBefore?: number): SubredditStats[] {
|
||||
@@ -770,7 +781,7 @@ export class MessagesRepository {
|
||||
.map((row) => [row.subreddit, row.total]),
|
||||
);
|
||||
|
||||
return rows.map(row => performanceStats(
|
||||
const results = rows.map(row => performanceStats(
|
||||
{
|
||||
subreddit: row.subreddit as string,
|
||||
totalSent: row.total_sent as number,
|
||||
@@ -779,6 +790,17 @@ export class MessagesRepository {
|
||||
},
|
||||
matureBefore === undefined ? undefined : pending.get(row.subreddit as string) ?? 0,
|
||||
));
|
||||
const matureSubreddits = new Set(rows.map((row) => row.subreddit as string));
|
||||
for (const [subreddit, pendingSent] of pending) {
|
||||
if (matureSubreddits.has(subreddit)) continue;
|
||||
results.push(performanceStats({
|
||||
subreddit,
|
||||
totalSent: 0,
|
||||
totalResponses: 0,
|
||||
totalImages: 0,
|
||||
}, pendingSent));
|
||||
}
|
||||
return results;
|
||||
}
|
||||
|
||||
getResponseRateTrend(days: number = 30): DailyTrend[] {
|
||||
|
||||
@@ -85,12 +85,15 @@ export class StrategySelector {
|
||||
for (const variant of this.variants) {
|
||||
const s = statsMap.get(variant.id);
|
||||
results.push({
|
||||
...(s ?? {
|
||||
strategyId: variant.id,
|
||||
totalSent: 0,
|
||||
totalResponses: 0,
|
||||
responseRate: 0,
|
||||
totalImages: 0,
|
||||
imageRate: 0,
|
||||
}),
|
||||
strategyId: variant.id,
|
||||
totalSent: s?.totalSent || 0,
|
||||
totalResponses: s?.totalResponses || 0,
|
||||
responseRate: s?.responseRate || 0,
|
||||
totalImages: s?.totalImages || 0,
|
||||
imageRate: s?.imageRate || 0,
|
||||
configured: true,
|
||||
});
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user