-
- {
- createQuestion({
- companyId: data.company,
- content: data.questionContent,
- location: data.location,
- questionType: data.questionType,
- role: data.role,
- seenAt: data.date,
- });
- }}
- />
+
+ {
+ createQuestion({
+ companyId: data.company,
+ content: data.questionContent,
+ location: data.location,
+ questionType: data.questionType,
+ role: data.role,
+ seenAt: data.date,
+ });
+ }}
+ />
+
- {
+ fetchNextPage();
+ }}
+ />
+ {questionCount === 0 && (
+
diff --git a/apps/portal/src/pages/questions/lists.tsx b/apps/portal/src/pages/questions/lists.tsx
index ea4009f8..cbf1b276 100644
--- a/apps/portal/src/pages/questions/lists.tsx
+++ b/apps/portal/src/pages/questions/lists.tsx
@@ -15,6 +15,7 @@ import DeleteListDialog from '~/components/questions/DeleteListDialog';
import { Button } from '~/../../../packages/ui/dist';
import { APP_TITLE } from '~/utils/questions/constants';
import createSlug from '~/utils/questions/createSlug';
+import relabelQuestionAggregates from '~/utils/questions/relabelQuestionAggregates';
import { trpc } from '~/utils/trpc';
export default function ListPage() {
@@ -172,37 +173,38 @@ export default function ListPage() {
{lists?.[selectedListIndex] && (
- {(questionsQueryData?.pages ?? []).flatMap(
- ({ data: questions }) =>
- questions.map((question) => (
+
+
+ {(questionsQueryData?.pages ?? []).flatMap(
+ ({ data: questions }) =>
+ questions.map((question) => {
+ const { companyCounts, locationCounts, roleCounts } =
+ relabelQuestionAggregates(
+ question.aggregatedQuestionEncounters,
+ );
+
+ return (
- )),
- )}
- {
- fetchNextPage();
- }}
- />
- {questionCount === 0 && (
-
+ );
+ }),
+ )}
+
-
-
- )}
- Nothing found.
- {hasFilters &&Try changing your search criteria.
} -
+
+
+ )}
Nothing found.
+ {hasFilters &&Try changing your search criteria.
} +
{lists[selectedListIndex].questionEntries.map(
- ({ question, id: entryId }) => (
- {
- deleteQuestionEntry({ id: entryId });
- }}
- />
- ),
+ ({ question, id: entryId }) => {
+ const { companyCounts, locationCounts, roleCounts } =
+ relabelQuestionAggregates(
+ question.aggregatedQuestionEncounters,
+ );
+
+ return (
+ {
+ deleteQuestionEntry({ id: entryId });
+ }}
+ />
+ );
+ },
)}
{lists[selectedListIndex].questionEntries?.length === 0 && (
diff --git a/apps/portal/src/utils/questions/relabelQuestionAggregates.ts b/apps/portal/src/utils/questions/relabelQuestionAggregates.ts
new file mode 100644
index 00000000..50a2a5dd
--- /dev/null
+++ b/apps/portal/src/utils/questions/relabelQuestionAggregates.ts
@@ -0,0 +1,26 @@
+import { JobTitleLabels } from '~/components/shared/JobTitles';
+
+import type { AggregatedQuestionEncounter } from '~/types/questions';
+
+export default function relabelQuestionAggregates({
+ locationCounts,
+ companyCounts,
+ roleCounts,
+ latestSeenAt,
+}: AggregatedQuestionEncounter) {
+ const newRoleCounts = Object.fromEntries(
+ Object.entries(roleCounts).map(([roleId, count]) => [
+ JobTitleLabels[roleId as keyof typeof JobTitleLabels],
+ count,
+ ]),
+ );
+
+ const relabeledAggregate: AggregatedQuestionEncounter = {
+ companyCounts,
+ latestSeenAt,
+ locationCounts,
+ roleCounts: newRoleCounts,
+ };
+
+ return relabeledAggregate;
+}