Bug cockpit
This commit is contained in:
@@ -199,6 +199,32 @@ function exportReviewRows(rows, filters) {
|
||||
URL.revokeObjectURL(url)
|
||||
}
|
||||
|
||||
function buildSelectedReviewExportRow(node, form) {
|
||||
if (!node) return null
|
||||
const meta = getProgramNodeReviewMeta({
|
||||
...node,
|
||||
review: {
|
||||
...(node.review || {}),
|
||||
status: form?.status || node.review?.status,
|
||||
comment: form?.comment ?? node.review?.comment,
|
||||
},
|
||||
})
|
||||
const comment = form?.comment ?? node.review?.comment ?? ''
|
||||
if (meta.status === 'unreviewed' && !comment.trim()) return null
|
||||
return {
|
||||
node: {
|
||||
...node,
|
||||
review: {
|
||||
...(node.review || {}),
|
||||
status: meta.status,
|
||||
comment,
|
||||
},
|
||||
},
|
||||
depth: 0,
|
||||
meta,
|
||||
}
|
||||
}
|
||||
|
||||
function ProgramReviewPanel({ selectedNode, reviewForm, onReviewChange, onSaveReview, readOnly = false, onOpenValidation }) {
|
||||
const [isFullscreen, setIsFullscreen] = useState(false)
|
||||
|
||||
@@ -1971,6 +1997,13 @@ function TutorApp({ currentUser, onLogout }) {
|
||||
)
|
||||
})
|
||||
const exportableReviewRows = filteredReviewRows.filter(({ node, meta }) => meta.status !== 'unreviewed' || Boolean(node.review?.comment))
|
||||
const selectedReviewExportRow = buildSelectedReviewExportRow(selectedProgramNode, programReviewForm)
|
||||
const selectedReviewAlreadyIncluded = selectedReviewExportRow
|
||||
? exportableReviewRows.some(({ node }) => node.key === selectedReviewExportRow.node.key)
|
||||
: true
|
||||
const reviewRowsToExport = selectedReviewExportRow && !selectedReviewAlreadyIncluded
|
||||
? [selectedReviewExportRow]
|
||||
: exportableReviewRows
|
||||
const selectedNodeStatus = selectedProgramNode?.status || {}
|
||||
const totalLessonCards = studentProgram?.assets?.reduce((sum, asset) => sum + (asset.sections?.length || 0), 0) || 0
|
||||
const remainingCards = Math.max(totalLessonCards - validatedCards, 0)
|
||||
@@ -2385,10 +2418,10 @@ function TutorApp({ currentUser, onLogout }) {
|
||||
<button
|
||||
type="button"
|
||||
className="secondary-button"
|
||||
onClick={() => exportReviewRows(exportableReviewRows, reviewFilters)}
|
||||
disabled={!exportableReviewRows.length}
|
||||
onClick={() => exportReviewRows(reviewRowsToExport, reviewFilters)}
|
||||
disabled={!reviewRowsToExport.length}
|
||||
>
|
||||
Exporter JSON ({exportableReviewRows.length})
|
||||
Exporter JSON ({reviewRowsToExport.length})
|
||||
</button>
|
||||
</div>
|
||||
<div className="review-filters">
|
||||
|
||||
Reference in New Issue
Block a user