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))"
radius={[4, 4, 0, 0]}
maxBarSize={60}
label="Total Users"
label="Monthly Completed Documents"
/>
</BarChart>
</ResponsiveContainer>

View File

@ -13,7 +13,7 @@ import { CallToAction } from '~/components/(marketing)/call-to-action';
import { BarMetric } from './bar-metrics';
import { CapTable } from './cap-table';
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 { MonthlyTotalUsersChart } from './monthly-total-users-chart';
import { TeamMembers } from './team-members';
@ -133,17 +133,18 @@ export default async function OpenPage() {
{ total_count: mergedPullRequests },
STARGAZERS_DATA,
EARLY_ADOPTERS_DATA,
MONTHLY_USERS,
MONTHLY_COMPLETED_DOCUMENTS,
] = await Promise.all([
fetchGithubStats(),
fetchOpenIssues(),
fetchMergedPullRequests(),
fetchStargazers(),
fetchEarlyAdopters(),
getUserMonthlyGrowth(),
getCompletedDocumentsMonthly(),
]);
const MONTHLY_USERS = await getUserMonthlyGrowth();
const MONTHLY_COMPLETED_DOCUMENTS = await getCompletedDocumentsMonthly();
return (
<div>
<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 () => {
const result = await prisma.$queryRaw<GetCompletedDocumentsMonthlyQueryResult>`
SELECT
DATE_TRUNC('month', "completedAt") AS "month",
DATE_TRUNC('month', "updatedAt") AS "month",
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"
WHERE "status" = 'COMPLETED'
GROUP BY "month"