Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

How to create a question button with custom score

New Here ,
May 05, 2017 May 05, 2017

Hi,

 

Lately I have been trying to create custom quizzes to deliver customer features.

I had a huge inspiration from another post by Steven Warwick by the use of intensive javascript. 

I have succeeded to calculate a custom score on a slide based on some inputs (selected / Not selected).

I trigger then an hidden question button and use the combination of undocumented functions : 

var quizObject= cp.getQuestionObject(QuestionButton);

cp.SubmitInteractions(QuestionButton,  cp.QuestionStatusEnum.CORRECT, 0) for score > 0

OR 

cp.SubmitInteractions(QuestionButton,  cp.QuestionStatusEnum.WRONG, 0) for score = 0

 

It works fine but I can get any partial score working using : cp.SubmitInteractions(QuestionButton,  cp.QuestionStatusEnum.PARTIAL_CORRECT, 0)

I know this is not documented but has anyboby already played with the QuizObject question to manage interactions and partial score?

 

Code EXAMPLE :

theAnswers = { 

 "Question_1" : "Selected",

 "Question_2" : "Normal",

 "Question_13" : "Selected",

 "Question_14" : "Normal"

 }

 

Poids = { 

 "Question_1" : 10,

 "Question_2" : 10,

"Question_13" : 10,

 "Question_14" : 10

 }

var QuestionButton = "ShapeQuestion";

/*******************************************************/

var score = 0;

for ( Shape in theAnswers) 

{

  rightAnswer = theAnswers[Shape];

  theState = cp.getCurrentStateNameForSlideItem(Shape);

  console.log('---- question Info -----');

  console.log('Status ='+theState);

 

  if (theState == rightAnswer)

  { 

    console.log('Status ='+theState);

    console.log('Good Answer : add '+Poids[Shape]);

    score = score + Poids[Shape];

    console.log('Score ='+score);

  }

 else

 {

    console.log('Wrong Answer');

 }

}

 

var quizObject= cp.getQuestionObject(QuestionButton);

 

if (score == 0) {

quizObject.score = 0;

cp.SubmitInteractions(QuestionButton,  cp.QuestionStatusEnum.WRONG, 0);

}

else

{

quizObject.score = score;

cp.SubmitInteractions(QuestionButton,  cp.QuestionStatusEnum.PARTIAL_CORRECT, 0);

}

console.log('Score Final ='+score);

cpCmndNextSlide = 1;

 

Any thoughts?

347
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
no replies

Have something to add?

Join the conversation
Resources
Help resources