Skip to content

Commit

Permalink
Merge pull request #43 from ucfopen/issue/35-same-text-answers
Browse files Browse the repository at this point in the history
Sends audio ID only if there is an audio asset
  • Loading branch information
clpetersonucf authored Jun 14, 2024
2 parents b4c2765 + ef6317f commit bd4058f
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/controllers/player.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ angular.module 'matching'
_pageIndex++

wrapQuestionUrl = ->
if item.assets[0] != 0 and item.assets[0] != undefined # for qsets published after this commit, this value will be 0, for older qsets it's undefined
if item.assets and item.assets?[0] != 0 and item.assets?[0] != undefined # for qsets published after this commit, this value will be 0, for older qsets it's undefined
return $sce.trustAsResourceUrl Materia.Engine.getImageAssetUrl(item.assets[0])

$scope.pages[_pageIndex].questions.push {
Expand Down Expand Up @@ -130,7 +130,7 @@ angular.module 'matching'
###

wrapAnswerUrl = ->
if item.assets[1] != 0 and item.assets[1] != undefined # for qsets published after this commit, this value will be 0, for older qsets it's undefined
if item.assets?[1] != 0 and item.assets?[1] != undefined # for qsets published after this commit, this value will be 0, for older qsets it's undefined
return $sce.trustAsResourceUrl Materia.Engine.getImageAssetUrl(item.assets[1])

$scope.pages[_pageIndex].answers.push {
Expand Down Expand Up @@ -560,7 +560,8 @@ angular.module 'matching'
matchedItemAnswerId = matchedItem[0].answerId
# get the answer of that match at that question id and use that as the 2nd argument
mappedQsetItemText = qsetItems.filter( (item) -> item.id == matchedItemAnswerId)[0].answers[0].text
mappedQsetAudioString = qsetItems.filter( (item) -> item.id == matchedItemAnswerId)[0].assets[2]
# the audioString should ONLY be provided if there is actually an audio asset present for the answer card - we check that by referencing assets[1]. Otherwise, pass null
mappedQsetAudioString = if qsetItems.filter( (item) -> item.id == matchedItemAnswerId)[0].assets and qsetItems.filter( (item) -> item.id == matchedItemAnswerId)[0].assets[1] != 0 then qsetItems.filter( (item) -> item.id == matchedItemAnswerId)[0].assets[2] else null
else
mappedQsetItemText = null
Materia.Score.submitQuestionForScoring(qsetItems[i].id, mappedQsetItemText, mappedQsetAudioString)
Expand Down

0 comments on commit bd4058f

Please sign in to comment.