How to check if a response is correct?

自闭症网瘾萝莉.ら 提交于 2020-01-05 01:08:09

问题


I want to create a tailor-made feedback sheet for my pupils depending on their answers to questions on a Google Form.

When iterating through ItemResponses from a Form response using the following code:

function response_deal() {
      var form = FormApp.openById('bla');
     var formResponses = form.getResponses();
     for (var i = 0; i < formResponses.length; i++) {
     var formResponse = formResponses[i];
     var itemResponses = formResponse.getItemResponses();
     for (var j = 0; j < itemResponses.length; j++) {
     var itemResponse = itemResponses[j];
     Logger.log('Response #%s to the question "%s" was "%s" and the score was "%s"',
     (i + 1).toString(),
     itemResponse.getItem().getTitle(),
     itemResponse.getResponse(),
     itemResponse.getScore()  );
     }
     }

     }

I need some code that will check whether the itemResponse is correct e.g.

if itemResponse.isCorrect()

or similar.

Does anyone know of there is a suitable method for this?

One technique I tried is to use the:

 itemResponse.getScore()

method but this returns null even if I setScore(1) etc. unless I allow the assignment to be graded and release a points score, which I don't want to do.

来源:https://stackoverflow.com/questions/44751071/how-to-check-if-a-response-is-correct

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!