Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds missing update method to score screen #71

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading