-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ConfirmationDialog.tsx): add support for deleting all errors ass…
…ociated with a project refactor(ConfirmationDialog.tsx): rename projectConfirmationAction prop to btnId for better semantics refactor(ConfirmationDialog.tsx): simplify handleConfirmAction function to handle both deleteProject and deleteAllErrors refactor(Backtrace.tsx): remove commented out BookmarkButton component feat(OccurrencesChartWrapper.tsx): create new component to display hourly occurrence chart for a list of occurrence ids feat: add revalidate constant to pages and components to improve Next.js ISR performance feat(Overview.tsx): add statistics section to display project statistics feat(Overview.tsx): add chart section to display hourly occurrences in the past 14 days feat(queries/notices.ts): add function to get all notice IDs for a given projectId refactor(occurrenceBookmarks.ts, occurrences.ts): remove unused orderByObject parameter from fetchOccurrenceBookmarks function and add new function to get occurrence IDs by notice IDs
- Loading branch information
1 parent
bc0739a
commit b0d1b5a
Showing
12 changed files
with
263 additions
and
150 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import OccurrenceChart from '@/components/OccurrenceChart'; | ||
import { prisma } from '@/lib/db'; | ||
|
||
interface OccurrencesChartWrapperProps { | ||
occurrenceIds: string[]; | ||
} | ||
|
||
async function OccurrencesChartWrapper({ occurrenceIds }: OccurrencesChartWrapperProps) { | ||
// Calculate the start and end date for the past two weeks | ||
const endDate = new Date(); | ||
const startDate = new Date(); | ||
startDate.setDate(endDate.getDate() - 14); | ||
|
||
// Query the database for the occurrence summaries for the past two weeks | ||
const occurrenceSummaries = await prisma.hourlyOccurrence.groupBy({ | ||
by: ['interval_start'], | ||
where: { | ||
occurrence_id: { | ||
in: occurrenceIds, | ||
}, | ||
interval_start: { | ||
gte: startDate.toISOString(), | ||
}, | ||
interval_end: { | ||
lte: endDate.toISOString(), | ||
}, | ||
}, | ||
_sum: { | ||
count: true, | ||
}, | ||
orderBy: { | ||
interval_start: 'asc', | ||
}, | ||
}); | ||
|
||
// Map the occurrence summaries to the format expected by the chart component | ||
const chartData = occurrenceSummaries.map((summary) => { | ||
return { | ||
date: summary.interval_start.toISOString().slice(0, 13), // Get date and hour only | ||
count: Number(summary._sum.count), | ||
}; | ||
}); | ||
|
||
return ( | ||
<div className="px-4 sm:px-6 lg:px-8"> | ||
<h2 className="mb-6 min-w-0 text-sm font-semibold leading-6 text-white"> | ||
Hourly Occurrences in the past 14 days | ||
</h2> | ||
|
||
<OccurrenceChart data={chartData} /> | ||
</div> | ||
); | ||
} | ||
|
||
export default OccurrencesChartWrapper as unknown as (props: OccurrencesChartWrapperProps) => JSX.Element; |
Oops, something went wrong.