import { getAllStreamsForVtuber, getStreamCountForVtuber } from "@/app/lib/streams"; import { getVodsForVtuber } from "@/app/lib/vods"; import { IVtuber } from "@futureporn/types"; export interface IArchiveProgressProps { vtuber: IVtuber; } export default async function ArchiveProgress ({ vtuber }: IArchiveProgressProps) { // // Check if totalStreams is not zero before calculating completedPercentage // const completedPercentage = (totalStreams !== 0) ? Math.round(eligibleStreams / totalStreams * 100) : 0; const goodStreams = await getStreamCountForVtuber(vtuber.id, ['good']) const issueStreams = await getStreamCountForVtuber(vtuber.id, ['issue']) const totalStreams = await getStreamCountForVtuber(vtuber.id) const eligibleStreams = goodStreams+issueStreams const completedPercentage = Math.floor((eligibleStreams / totalStreams) * 100) return (
{totalStreams} known streams
{goodStreams} streams archived
{issueStreams} streams with issues
{eligibleStreams}/{totalStreams} Streams Archived ({completedPercentage}%)
{(vods) ? vods.data.length : 0} vods
//