Files
no-twitter-bot-stats/src/lib/lineChartArray.ts
Lucid b71fb89832
All checks were successful
Main / build-and-push-docker-image (20.x) (push) Successful in 6m48s
Daily Cron (Make New DailyStats Document) / cron (push) Successful in 2s
Upgraded dependencies. Updated terminology and wording. Updated bot name. FIx text center and line height.
2025-12-30 13:23:36 -05:00

29 lines
745 B
TypeScript

import { DailyStats } from "@/types/DailyStats";
import { LineChartArr, LineChartItem } from "@/types/LineChartStats";
const lineChartArr = (dailyStatsArr: DailyStats): LineChartArr => {
const lineChartArr = [] as LineChartArr;
if (dailyStatsArr.length) {
dailyStatsArr.forEach((item) => {
const { linksDeleted, commandResponses, timesTriggered, createdAt } =
item;
const day = new Date(Number(createdAt)).getDate();
const lineChartItem: LineChartItem = {
day,
"Links Deleted": linksDeleted,
"Command Responses": commandResponses,
Triggers: timesTriggered
};
lineChartArr.push(lineChartItem);
});
}
return lineChartArr;
};
export default lineChartArr;