Skip to content

Commit

Permalink
Merge pull request #71 from clpetersonucf/issue/58-scorecore-missing-…
Browse files Browse the repository at this point in the history
…update-method

Adds missing update method to score screen
  • Loading branch information
clpetersonucf authored Apr 16, 2024
2 parents 2ce38d1 + fc8ff55 commit 5a0252f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/controllers/ctl-scoreScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ export const ControllerThisOrThatScorescreen = function($scope, $sce) {

const materiaCallbacks = {}

const getHeight = () => Math.ceil(parseFloat(window.getComputedStyle(document.querySelector('html')).height))

const getQuestionIndex = (qset, id) => {
for (let i = 0; i < qset.items.length; i++) {
if (qset.items[i].id == id) return i
Expand All @@ -21,7 +23,7 @@ export const ControllerThisOrThatScorescreen = function($scope, $sce) {
return parseInt((overallDeduction / numIncorrect) * 100)
}

materiaCallbacks.start = (instance, qset, scoreTable, isPreview, qsetVersion) => {
materiaCallbacks.update = (qset, scoreTable) => {
$scope.$apply(() => {
$scope.items = scoreTable.map((question, index) => {

Expand Down Expand Up @@ -60,6 +62,12 @@ export const ControllerThisOrThatScorescreen = function($scope, $sce) {
return item
})
})

Materia.ScoreCore.setHeight(getHeight())
}

materiaCallbacks.start = (instance, qset, scoreTable, isPreview, qsetVersion) => {
materiaCallbacks.update(qset, scoreTable)
}

Materia.ScoreCore.hideResultsTable()
Expand Down
1 change: 1 addition & 0 deletions src/scoreScreen.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ describe('Score Screen Controller', function() {
start: jest.fn(methods => {
publicMethods = methods
}),
setHeight: jest.fn(),
// alert: jest.fn(),
// cancelSave: jest.fn(),
// save: jest.fn().mockImplementation((title, qset) => {
Expand Down

0 comments on commit 5a0252f

Please sign in to comment.