Replacing the Default Score in report.html file with a custom variable

Hello,

I've been working on customizing the report.html file for a course I've built. I'm aware of the "basics" post found on these forums, and I've been able to find a few forums that have helped me successfully remove the Points Awarded column from the report. However, I've got a few "Pick Many" questions that have partial scoring, so I'm using my own custom variable within the course to track the points properly - I know that an LMS isn't capable of partial scoring, but I'm not actually reporting to an LMS, I'm just trying to allow users to print the report.html file as proof of completion - but I need the default "Student Score" to be replaced with my custom variable. Any html experts out there that can help me?

7 Replies
Russell Killips

Hello Geremy,

You need to edit 2 lines of code in the report.html file to remove the Points Column.

Step 1: Remove Column Heading
There is a function called: createQuizDiv(quiz)    Around Line 222
Within that function change: { elName: 'th', text: strings.pointsAwarded, enabled: !survey }
To: { elName: 'th', text: strings.pointsAwarded, enabled: false }

Step 2: Remove The Points Field for each row.
There is a function called: getQuestionConfig(quiz, questionIdx)   Around Line 320
Within that function change: { elName: 'td', text: question.nPoints, enabled: !survey }
To: { elName: 'td', text: question.nPoints, enabled: false }

 

Now for your Custom Score
You will need to edit the function: displayCourseSummary()   Around Line 160

At the very beginning of the function (right before the var survey = ...) you will need to retrieve your custom score.

Add in two lines of code:
var player = window.opener.GetPlayer();
var CustomScore = player.GetVar("YourCustomScoreVariable");

Then a few lines down you need to change: studentScore = Number(mainQuiz.nPtScore),
To: studentScore = CustomScore,

Geremy Gortemaker

Thank you so much for replying - I was able to get the extra column and info removed based off of another forum (I opted to delete the lines entirely instead of making them false, it seems to work - hopefully that isn't an issue), but I can't seem to get the Custom Score to work. I found the area, but when I tried to edit, the whole report went blank.

I've attached the report file, could you take a look?

I've got another wrinkle to add in that I didn't think of before - this is a two part challenge, so there's a chance that a user views one of two different challenges. Is there a chance I can make the report pull from one of the two custom variables, or do I need to rework the programming so it's only one custom variable? It's set to reset the score to 0 as soon as they leave the results page, so I think I can make one work if need be. 

The current Custom Variables are %TotalScoreCorn% and %TotalScoreTomatoe%

Again, thanks SO MUCH for the reply

Geremy Gortemaker

I understand, thanks for your advice, uploading the file actually made it work correctly!

Now I just need to find a way to display whichever of the two custom scores isn't 0, or reprogram to have them use a single variable for both sides of the challenge... Any input would be appreciated, but I don't mean to be a pain. You've made a huge difference already!

Russell Killips

I would default the two scores to -1 because it is possible to get a 0 for a score.

Then in the report use:

var player = window.opener.GetPlayer();

var CornScore = player.GetVar(“TotalScoreCorn”);

var TomatoeScore = player.GetVar(“TotalScoreTomatoe”);

if (CornScore>-1) {

var CustomScore = CornScore;

}else{

var CustomScore = TomatoeScore;

}