Skip to content

Commit f40f547

Browse files
committed
export library
1 parent a76447d commit f40f547

File tree

3 files changed

+21
-4
lines changed

3 files changed

+21
-4
lines changed

src/components/assessment/assessmentShape.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ export enum QuestionTypes {
106106
export type QuestionType = keyof typeof QuestionTypes
107107

108108
/** Constants for external library names */
109-
export enum ExternalLibraryNames {
109+
enum ExternalLibraryNames {
110110
NONE = 'NONE',
111111
TWO_DIM_RUNES = 'TWO_DIM_RUNES',
112112
THREE_DIM_RUNES = 'THREE_DIM_RUNES',

src/utils/xmlParseStrShapes.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {
2-
ExternalLibraryNames,
2+
ExternalLibraryName,
33
IQuestion
44
} from '../components/assessment/assessmentShape'
55

@@ -23,7 +23,7 @@ export interface IXmlParseStrDeployment{
2323
},
2424
EXTERNAL: Array<{
2525
$: {
26-
name: ExternalLibraryNames,
26+
name: ExternalLibraryName,
2727
},
2828
SYMBOL: string[],
2929
}>

src/utils/xmlParser.ts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
MCQChoice
1212
} from '../components/assessment/assessmentShape'
1313
import {
14+
IXmlParseStrDeployment,
1415
IXmlParseStrCProblem,
1516
IXmlParseStrOverview,
1617
IXmlParseStrPProblem,
@@ -67,7 +68,7 @@ const makeLibrary = (task: IXmlParseStrTask) : Library => {
6768
const external = task.DEPLOYMENT[0].EXTERNAL;
6869
const nameVal = external ?
6970
external[0].$.name
70-
: "NONE";
71+
: 'NONE';
7172
const symbolsVal : string[] = external ?
7273
external[0].SYMBOL
7374
: [];
@@ -160,6 +161,21 @@ export const assessmentToXml = (assessment: IAssessment, overview: IAssessmentOv
160161
task.TEXT = [assessment.longSummary];
161162
task.PROBLEMS = [];
162163

164+
const library : Library = assessment.questions[0].library;
165+
const deployment : IXmlParseStrDeployment = {
166+
$: {
167+
interpreter: library.chapter.toString()
168+
},
169+
EXTERNAL: [{
170+
$: {
171+
name: library.external.name,
172+
},
173+
SYMBOL: library.external.symbols,
174+
}]
175+
}
176+
177+
task.DEPLOYMENT = deployment;
178+
163179
assessment.questions.forEach((question: IProgrammingQuestion | IMCQQuestion) => {
164180
const problem = {
165181
$: {
@@ -195,5 +211,6 @@ export const assessmentToXml = (assessment: IAssessment, overview: IAssessmentOv
195211

196212
task.PROBLEMS.push(problem);
197213
});
214+
198215
return task;
199216
}

0 commit comments

Comments
 (0)