More cards
This commit is contained in:
@@ -25,6 +25,29 @@ export interface PageEnrichment {
|
||||
stats: { attention: number | null; depth: number; reach: number };
|
||||
}
|
||||
|
||||
/** Immutable numeric Wikipedia metrics committed to a minted block. */
|
||||
export type MintStatsSnapshot = {
|
||||
capturedAt: string;
|
||||
revisionId: number;
|
||||
pageBytes: number;
|
||||
languageCount: number;
|
||||
languagesTruncated: boolean;
|
||||
pageviews: PageEnrichment['pageviews'];
|
||||
stats: PageEnrichment['stats'];
|
||||
};
|
||||
|
||||
export function snapshotStats(data: PageEnrichment): MintStatsSnapshot {
|
||||
return {
|
||||
capturedAt: new Date().toISOString(),
|
||||
revisionId: data.revisionId,
|
||||
pageBytes: data.pageBytes,
|
||||
languageCount: data.languageCount,
|
||||
languagesTruncated: data.languagesTruncated,
|
||||
pageviews: { ...data.pageviews, months: data.pageviews.months.map(item => ({ ...item })) },
|
||||
stats: { ...data.stats },
|
||||
};
|
||||
}
|
||||
|
||||
/** Attention uses the latest completed month's views, not the six-month total. */
|
||||
export function deriveStats(pageBytes: number, languageCount: number, monthlyViews: number | null): PageEnrichment['stats'] {
|
||||
const score = (value: number, scale: number) => {
|
||||
|
||||
Reference in New Issue
Block a user