diff --git a/src/components/Benchmarks/BenchmarkDetail.tsx b/src/components/Benchmarks/BenchmarkDetail.tsx index 883e607..acc1e64 100644 --- a/src/components/Benchmarks/BenchmarkDetail.tsx +++ b/src/components/Benchmarks/BenchmarkDetail.tsx @@ -42,6 +42,13 @@ const BenchmarkDetail = ({ editorRef.current = editor; } + const { + isLoading: isBenchmarkLoading, + isError: isBenchmarkError, + data: benchmarkData, + error, + } = useBenchmarkDetail(match.params.id); + let lastSubmission; const { isLoading: isLastSubmissionLoading, @@ -89,17 +96,11 @@ const BenchmarkDetail = ({ lintScore={jobData.lintScore} lintErrors={jobData.lintErrors} isLoading={isProcessing} + maxCyclomaticComplexity={benchmarkData?.maxCyclomaticComplexity} /> ); } - const { - isLoading: isBenchmarkLoading, - isError: isBenchmarkError, - data: benchmarkData, - error, - } = useBenchmarkDetail(match.params.id); - if (isBenchmarkLoading) { return Loading....; } diff --git a/src/components/Benchmarks/BenchmarkModel.ts b/src/components/Benchmarks/BenchmarkModel.ts index 8bf42aa..51aae5f 100644 --- a/src/components/Benchmarks/BenchmarkModel.ts +++ b/src/components/Benchmarks/BenchmarkModel.ts @@ -5,6 +5,7 @@ export default class benchmarkModel { gitUrl: null | undefined; createdAt: string | undefined; difficulty: string | undefined; + maxCyclomaticComplexity: number | undefined; creator: | { id: string | undefined; diff --git a/src/components/Benchmarks/CreateBenchmark.tsx b/src/components/Benchmarks/CreateBenchmark.tsx index c08426e..64a6040 100644 --- a/src/components/Benchmarks/CreateBenchmark.tsx +++ b/src/components/Benchmarks/CreateBenchmark.tsx @@ -29,6 +29,7 @@ const CreateBenchmark: React.FC = () => { const title = event.target.title.value; const subject = event.target.subject.value; const difficulty = event.target.difficulty.value; + const maxCyclomaticComplexity = event.target.maxCylomaticComplexity.value; if (title === '' || subject === '') { setMessage('At least one field is blank'); @@ -36,7 +37,7 @@ const CreateBenchmark: React.FC = () => { return; } - mutate({ title, subject, difficulty }); + mutate({ title, subject, difficulty, maxCyclomaticComplexity }); }; return ( @@ -75,6 +76,23 @@ const CreateBenchmark: React.FC = () => { /> +