stats: firstE -> firstTaggedId

This commit is contained in:
Alex Gleason 2023-12-10 16:32:43 -06:00
parent a5369d9826
commit 2d3f12dc72
No known key found for this signature in database
GPG Key ID: 7211D1F99744FBB7
1 changed files with 5 additions and 5 deletions

View File

@ -26,7 +26,7 @@ async function updateStats(event: Event) {
function getStatsDiff(event: Event): StatDiff[] { function getStatsDiff(event: Event): StatDiff[] {
const statDiffs: StatDiff[] = []; const statDiffs: StatDiff[] = [];
const firstE = event.tags.find(([name]) => name === 'e')?.[1]; const firstTaggedId = event.tags.find(([name]) => name === 'e')?.[1];
const inReplyToId = findReplyTag(event as Event<1>)?.[1]; const inReplyToId = findReplyTag(event as Event<1>)?.[1];
switch (event.kind) { switch (event.kind) {
@ -37,13 +37,13 @@ function getStatsDiff(event: Event): StatDiff[] {
} }
break; break;
case 6: case 6:
if (firstE) { if (firstTaggedId) {
statDiffs.push(['event_stats', firstE, 'reposts_count', 1]); statDiffs.push(['event_stats', firstTaggedId, 'reposts_count', 1]);
} }
break; break;
case 7: case 7:
if (firstE) { if (firstTaggedId) {
statDiffs.push(['event_stats', firstE, 'reactions_count', 1]); statDiffs.push(['event_stats', firstTaggedId, 'reactions_count', 1]);
} }
} }