Skip to content

Commit

Permalink
fix: hide test case for database
Browse files Browse the repository at this point in the history
  • Loading branch information
HollaG committed Nov 14, 2024
1 parent 412fe1f commit f6ca12f
Showing 1 changed file with 51 additions and 33 deletions.
84 changes: 51 additions & 33 deletions peer-prep/src/pages/Session/Summary/SessionSummaryPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import {
IconCircleXFilled,
IconDatabase,
IconHourglassEmpty,
IconInfoCircle,
} from "@tabler/icons-react";
import { notifications } from "@mantine/notifications";
import CodeEditorWithLanguageSelector from "../../../components/Questions/CodeEditor/CodeEditor";
Expand All @@ -48,6 +49,7 @@ import { CodeHighlight } from "@mantine/code-highlight";
import { kBtoMb, secondsToMsIfappropriate } from "../../../utils/utils";
import { useDisclosure } from "@mantine/hooks";

const BLOCKED_CATEGORY_IDS = [2];
export default function SessionSummaryPage() {
const { fetchData } = useApi();

Expand All @@ -57,6 +59,10 @@ export default function SessionSummaryPage() {

const [attempt, setAttempt] = useState<UserAttempt>(attemptReceived);

const isBlockedFromRunningTestCase = attempt?.question.categoriesId?.some(
(id) => BLOCKED_CATEGORY_IDS.includes(id)
);

// Attempt data to display
const [completedAt, setCompletedAt] = useState("");
const [otherUserDisplayName, setOtherUserDisplayName] = useState("");
Expand Down Expand Up @@ -349,38 +355,49 @@ export default function SessionSummaryPage() {
)}
</Paper>

<Paper radius="md" withBorder className={classes.testCases}>
<Title order={4}>Test Case Summary</Title>
<Text>
Passed: {passed}, Failed: {failed}
</Text>
<Box
// my="md"
p="md"
// withBorder
// className={privateTestsPassed ? classes.ptcPassed : classes.ptcFailed}
{isBlockedFromRunningTestCase ? (
<Alert
variant="light"
color="orange"
title="Test case results not available"
icon={<IconInfoCircle />}
style={{ width: "100%" }}
>
{privateTestsPassed ? (
<Alert
variant="light"
color="green"
title="All private test cases passed"
icon={<IconCircleCheckFilled />}
>
Details for private test cases are hidden.
</Alert>
) : (
<Alert
variant="light"
color="red"
title="Some private test cases failed"
icon={<IconCircleXFilled />}
>
Details for private test cases are hidden.
</Alert>
)}
</Box>
{/* <Accordion multiple mt={10}>
Testcase running is disabled for Database questions.
</Alert>
) : (
<Paper radius="md" withBorder className={classes.testCases}>
<Title order={4}>Test Case Summary</Title>
<Text>
Passed: {passed}, Failed: {failed}
</Text>
<Box
// my="md"
p="md"
// withBorder
// className={privateTestsPassed ? classes.ptcPassed : classes.ptcFailed}
>
{privateTestsPassed ? (
<Alert
variant="light"
color="green"
title="All private test cases passed"
icon={<IconCircleCheckFilled />}
>
Details for private test cases are hidden.
</Alert>
) : (
<Alert
variant="light"
color="red"
title="Some private test cases failed"
icon={<IconCircleXFilled />}
>
Details for private test cases are hidden.
</Alert>
)}
</Box>
{/* <Accordion multiple mt={10}>
{testCaseResults.map((result, index) => (
<Accordion.Item key={index} value={result._id}>
<Accordion.Control
Expand All @@ -406,8 +423,9 @@ export default function SessionSummaryPage() {
</Accordion.Item>
))}
</Accordion> */}
<TestCasesDisplay testCaseResults={testCaseResults} />
</Paper>
<TestCasesDisplay testCaseResults={testCaseResults} />
</Paper>
)}
</Flex>
);
}
Expand Down

0 comments on commit f6ca12f

Please sign in to comment.