Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | 38x 38x 38x 10x 10x 10x 38x 10x 10x 4x 6x 38x 10x | import React, { useState } from "react";
import { Alert, Card } from "react-bootstrap";
import { useBackendMutation } from "main/utils/useBackend";
import CATMEAuditCSVUploadForm from "main/components/CATME/CATMEAuditCSVUploadForm";
import CATMEAuditResults from "main/components/CATME/CATMEAuditResults";
export default function CATMEAuditCard({ courseId, testIdPrefix }) {
const [results, setResults] = useState(null);
const [errorMessage, setErrorMessage] = useState(null);
const objectToAxiosParams = (formData) => {
const file = new FormData();
file.append("file", formData.upload[0]);
return {
url: "/api/catme/audit",
method: "POST",
data: file,
params: { courseId },
};
};
const auditMutation = useBackendMutation(objectToAxiosParams, {
onMutate: () => {
setResults(null);
setErrorMessage(null);
},
onSuccess: (data) => {
setResults(data);
},
onError: (error) => {
setErrorMessage(
error.response?.data?.message ??
"The audit could not be completed. Please try again.",
);
},
});
return (
<Card className="mt-4" data-testid={`${testIdPrefix}-catme-audit-card`}>
<Card.Header as="h5" data-testid={`${testIdPrefix}-catme-audit-header`}>
Audit CATME Teammaker CSV Download
</Card.Header>
<Card.Body>
<p>
When using CATME Teammaker, this option will allow you to ensure that
the roster of students in CATME is up-to-date with the course roster
in Frontiers. It treats the Frontiers as the "source of
truth" and lets you know what students need to be added to CATME,
removed from CATME, or have their information in CATME (name, section)
updated.
</p>
<p className="mb-1">To use it:</p>
<ol>
<li>
Navigate to the page <code>/faculty/tm_display_results</code> in
CATME and click the Export to CSV button.
</li>
<li>Upload that file here.</li>
<li>Read the results.</li>
</ol>
<CATMEAuditCSVUploadForm
submitAction={(formData) => auditMutation.mutate(formData)}
testIdPrefix={`${testIdPrefix}-catme-audit-form`}
/>
{errorMessage !== null && (
<Alert
variant="danger"
className="mt-3"
data-testid={`${testIdPrefix}-catme-audit-error`}
>
{errorMessage}
</Alert>
)}
{results !== null && (
<CATMEAuditResults
results={results}
testIdPrefix={`${testIdPrefix}-catme-audit-results`}
/>
)}
</Card.Body>
</Card>
);
}
|