fix: invalid datetime on graph

This commit is contained in:
Ephraim Atta-Duncan
2024-03-21 00:48:49 +00:00
parent 0dfdf36bda
commit a8752098f6
3 changed files with 8 additions and 7 deletions

View File

@ -47,7 +47,7 @@ export const MonthlyCompletedDocumentsChart = ({
fill="hsl(var(--primary))" fill="hsl(var(--primary))"
radius={[4, 4, 0, 0]} radius={[4, 4, 0, 0]}
maxBarSize={60} maxBarSize={60}
label="Total Users" label="Monthly Completed Documents"
/> />
</BarChart> </BarChart>
</ResponsiveContainer> </ResponsiveContainer>

View File

@ -13,7 +13,7 @@ import { CallToAction } from '~/components/(marketing)/call-to-action';
import { BarMetric } from './bar-metrics'; import { BarMetric } from './bar-metrics';
import { CapTable } from './cap-table'; import { CapTable } from './cap-table';
import { FundingRaised } from './funding-raised'; import { FundingRaised } from './funding-raised';
import { MonthlyCompletedDocumentsChart } from './monthly-completed-documents-chart copy'; import { MonthlyCompletedDocumentsChart } from './monthly-completed-documents-chart';
import { MonthlyNewUsersChart } from './monthly-new-users-chart'; import { MonthlyNewUsersChart } from './monthly-new-users-chart';
import { MonthlyTotalUsersChart } from './monthly-total-users-chart'; import { MonthlyTotalUsersChart } from './monthly-total-users-chart';
import { TeamMembers } from './team-members'; import { TeamMembers } from './team-members';
@ -133,17 +133,18 @@ export default async function OpenPage() {
{ total_count: mergedPullRequests }, { total_count: mergedPullRequests },
STARGAZERS_DATA, STARGAZERS_DATA,
EARLY_ADOPTERS_DATA, EARLY_ADOPTERS_DATA,
MONTHLY_USERS,
MONTHLY_COMPLETED_DOCUMENTS,
] = await Promise.all([ ] = await Promise.all([
fetchGithubStats(), fetchGithubStats(),
fetchOpenIssues(), fetchOpenIssues(),
fetchMergedPullRequests(), fetchMergedPullRequests(),
fetchStargazers(), fetchStargazers(),
fetchEarlyAdopters(), fetchEarlyAdopters(),
getUserMonthlyGrowth(),
getCompletedDocumentsMonthly(),
]); ]);
const MONTHLY_USERS = await getUserMonthlyGrowth();
const MONTHLY_COMPLETED_DOCUMENTS = await getCompletedDocumentsMonthly();
return ( return (
<div> <div>
<div className="mx-auto mt-6 max-w-screen-lg sm:mt-12"> <div className="mx-auto mt-6 max-w-screen-lg sm:mt-12">

View File

@ -17,9 +17,9 @@ type GetCompletedDocumentsMonthlyQueryResult = Array<{
export const getCompletedDocumentsMonthly = async () => { export const getCompletedDocumentsMonthly = async () => {
const result = await prisma.$queryRaw<GetCompletedDocumentsMonthlyQueryResult>` const result = await prisma.$queryRaw<GetCompletedDocumentsMonthlyQueryResult>`
SELECT SELECT
DATE_TRUNC('month', "completedAt") AS "month", DATE_TRUNC('month', "updatedAt") AS "month",
COUNT("id") as "count", COUNT("id") as "count",
SUM(COUNT("id")) OVER (ORDER BY DATE_TRUNC('month', "completedAt")) as "cume_count" SUM(COUNT("id")) OVER (ORDER BY DATE_TRUNC('month', "updatedAt")) as "cume_count"
FROM "Document" FROM "Document"
WHERE "status" = 'COMPLETED' WHERE "status" = 'COMPLETED'
GROUP BY "month" GROUP BY "month"