Skip to content

Commit 36d76e0

Browse files
committed
feat: quiz question files being replaced
1 parent bec2532 commit 36d76e0

5 files changed

Lines changed: 20 additions & 1 deletion

File tree

assets/js/Components/Widgets/FileReviewPreview.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ export default function FixIssuesContentPreview({
145145
<tr key={index}>
146146
<td className='content-title'>{ref.contentItemTitle}</td>
147147
<td>
148-
<a href={ref.contentItemUrl} target='_blank' className='location-link flex-row align-items-center'>
148+
<a href={ref.contentType == "quiz_question" ? ref.contentItemUrl.replace(/\/questions.*/, "/edit#questions_tab") : ref.contentItemUrl} target='_blank' className='location-link flex-row align-items-center'>
149149
{t('form.file.external_url.label')}
150150
<ExternalLinkIcon />
151151
</a>

assets/js/Services/Report.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -449,5 +449,6 @@ export function analyzeReport(report, ISSUE_STATE) {
449449
tempReport.sessionFiles = sessionFiles
450450
tempReport.filesReviewed = tempFilesReviewed
451451

452+
console.log(tempReport)
452453
return tempReport
453454
}

src/Lms/Canvas/CanvasApi.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,9 @@ public function apiPutBatch(array $paths, array $options){
291291
if(str_contains($type, "quiz")){
292292
$type = "quiz";
293293
}
294+
if (str_contains($url, 'question')) {
295+
$type = "quiz_question";
296+
}
294297
$lmsId = $matches[2];
295298
}
296299

src/Lms/Canvas/CanvasLms.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -644,8 +644,11 @@ public function postContentItemNoIssue($contentOptions, $sectionOptions)
644644
$sectionOptionsBuild = [];
645645
$deletePaths = [];
646646
foreach($contentOptions as $option){
647+
$output->writeln(json_encode($option, JSON_PRETTY_PRINT));
647648
$paths[] = $option['contentUrl'];
648649
$options[] = $this->createLmsPostOptionsWithHtml($option['contentType'], $option['fullPageHtml']);
650+
$output->writeln(json_encode($paths, JSON_PRETTY_PRINT));
651+
$output->writeln(json_encode($options, JSON_PRETTY_PRINT));
649652
}
650653

651654
foreach($sectionOptions as $sectionOption){
@@ -954,6 +957,13 @@ protected function createLmsPostOptionsWithHtml($type, $fullPageHtml){
954957
'message' => $fullPageHtml,
955958
];
956959
break;
960+
case('quiz_question'):
961+
$options = [
962+
'question' => [
963+
'question_text' => $fullPageHtml,
964+
],
965+
];
966+
break;
957967
default:
958968
break;
959969
}

yarn.lock

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2228,6 +2228,11 @@ chownr@^2.0.0:
22282228
resolved "https://registry.yarnpkg.com/chownr/-/chownr-2.0.0.tgz#15bfbe53d2eab4cf70f18a8cd68ebe5b3cb1dece"
22292229
integrity sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==
22302230

2231+
chroma-js@^3.1.2:
2232+
version "3.2.0"
2233+
resolved "https://registry.yarnpkg.com/chroma-js/-/chroma-js-3.2.0.tgz#4e9e665290b9bbfece524fccf759d5120e351ff2"
2234+
integrity sha512-os/OippSlX1RlWWr+QDPcGUZs0uoqr32urfxESG9U93lhUfbnlyckte84Q8P1UQY/qth983AS1JONKmLS4T0nw==
2235+
22312236
chrome-trace-event@^1.0.2:
22322237
version "1.0.4"
22332238
resolved "https://registry.yarnpkg.com/chrome-trace-event/-/chrome-trace-event-1.0.4.tgz#05bffd7ff928465093314708c93bdfa9bd1f0f5b"

0 commit comments

Comments
 (0)