-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "Revert "feat(FEV-1168): Add "quiz" type of cue-points to Kalt…
- Loading branch information
1 parent
b2f7cce
commit a99527d
Showing
6 changed files
with
135 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import ILoader = KalturaPlayerTypes.ILoader; | ||
import {KalturaCuePointListResponse, KalturaQuizQuestionCuePoint, KalturaCuePoint} from './response-types'; | ||
|
||
const {RequestBuilder} = KalturaPlayer.providers; | ||
interface KalturaQuizQuestionCuePointsResponse { | ||
quizQuestionCuePoints: Array<KalturaQuizQuestionCuePoint>; | ||
} | ||
export class QuizQuestionLoader implements ILoader { | ||
_entryId: string = ''; | ||
_requests: any[] = []; | ||
_response: KalturaQuizQuestionCuePointsResponse = {quizQuestionCuePoints: []}; | ||
|
||
static get id(): string { | ||
return 'quiz-question'; | ||
} | ||
|
||
constructor(params: {entryId: string}) { | ||
this._entryId = params.entryId; | ||
const headers: Map<string, string> = new Map(); | ||
const request = new RequestBuilder(headers); | ||
|
||
request.service = 'cuepoint_cuepoint'; | ||
request.action = 'list'; | ||
request.params = { | ||
filter: { | ||
objectType: 'KalturaQuestionCuePointFilter', | ||
entryIdEqual: this._entryId, | ||
cuePointTypeEqual: KalturaCuePoint.KalturaCuePointType.QUIZ_QUESTION, | ||
orderBy: '+startTime' | ||
} | ||
}; | ||
this.requests.push(request); | ||
} | ||
|
||
set requests(requests: any[]) { | ||
this._requests = requests; | ||
} | ||
|
||
get requests(): any[] { | ||
return this._requests; | ||
} | ||
|
||
set response(response: any) { | ||
const cuePointList = new KalturaCuePointListResponse<KalturaQuizQuestionCuePoint>(response[0]?.data, KalturaQuizQuestionCuePoint); | ||
if (cuePointList.totalCount) { | ||
this._response.quizQuestionCuePoints = cuePointList.cuePoints; | ||
} | ||
} | ||
|
||
get response(): any { | ||
return this._response; | ||
} | ||
|
||
isValid(): boolean { | ||
return !!this._entryId; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
export * from './kaltura-cue-point'; | ||
export * from './kaltura-code-cue-point'; | ||
export * from './kaltura-thumb-cue-point'; | ||
export * from './kaltura-cue-point-list-response'; | ||
export * from './kaltura-quiz-question-cue-point'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
src/providers/vod/response-types/kaltura-quiz-question-cue-point.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import {KalturaCuePoint} from './kaltura-cue-point'; | ||
|
||
export enum KalturaQuestionType { | ||
fillInBlank = 5, | ||
goTo = 7, | ||
hotSpot = 6, | ||
multipleAnswerQuestion = 4, | ||
multipleChoiceAnswer = 1, | ||
openQuestion = 8, | ||
reflectionPoint = 3, | ||
trueFalse = 2 | ||
} | ||
|
||
export interface OptionalAnswer { | ||
isCorrect: boolean; | ||
key: string; | ||
objectType: string; | ||
text?: string; | ||
weight: number; | ||
} | ||
|
||
export class KalturaQuizQuestionCuePoint extends KalturaCuePoint { | ||
excludeFromScore: boolean; | ||
objectType: string; | ||
optionalAnswers: Array<OptionalAnswer>; | ||
question: string; | ||
questionType: KalturaQuestionType; | ||
userId: string; | ||
|
||
constructor(codeCuePoint: any) { | ||
super(codeCuePoint); | ||
this.excludeFromScore = codeCuePoint.excludeFromScore; | ||
this.objectType = codeCuePoint.objectType; | ||
this.optionalAnswers = codeCuePoint.optionalAnswers; | ||
this.question = codeCuePoint.question; | ||
this.questionType = codeCuePoint.questionType; | ||
this.userId = codeCuePoint.userId; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters