以编程方式在Google Apps脚本的测验中允许查看分数

问题描述 投票:2回答:1

Google最近添加了在Google Apps脚本中编写测验的功能

var form = FormApp.create('Ice cream Quiz').setIsQuiz(true);
form.set
  // Make a 10 point question and set feedback on it
  var item = form.addCheckboxItem();
  item.setTitle("What flavors are in neapolitan ice cream?");
  item.setPoints(10);
  // chocolate, vanilla, and strawberry are the correct answers
  item.setChoices([
    item.createChoice("chocolate", true),
    item.createChoice("vanilla", true),
    item.createChoice("rum raisin", false),
    item.createChoice("strawberry", true),
    item.createChoice("mint", false)
  ]);
  // If the respondent answers correctly, they'll see this feedback when they view 
  //scores.
  var correctFeedback = FormApp.createFeedback()
      .setText("You're an ice cream expert!")
      .build();
  item.setFeedbackForCorrect(correctFeedback);

  // If they respond incorrectly, they'll see this feedback with helpful links to 
  //read more about ice cream.
  var incorrectFeedback = FormApp.createFeedback()
      .setText("Sorry, wrong answer")
      .addLink(
        "https://en.wikipedia.org/wiki/Neapolitan_ice_cream",
        "Read more")
      .build();
  item.setFeedbackForIncorrect(incorrectFeedback);

我希望测验的收件人能够自动查看自己的分数。我不知道如何以编程方式执行此操作。相反,我需要通过锣手动进入测验设置,然后将发布等级设置为“提交后立即”,并且响应者可以看到“错过的问题”,“正确的答案”,“点值”

是否可以通过编程方式设置这些?

google-apps-script google-form google-form-quiz
1个回答
0
投票

这个问题之前被问到here(但我的答案尚未被投票或接受,因此我不能将其标记为重复)。这是我建议的解决方法:

AFAIAA,目前无法使用Google Apps脚本方法直接执行此操作。

一种可行的解决方法是创建一个最小的Google表单,使其成为一个测验,并将其配置为“每次提交后立即”。不是在脚本中创建表单,而是仅复制此表单文件(使用您的脚本)并继续以编程方式在副本中构建测验。

值得注意的是,Google Apps脚本中的这一遗漏可能会导致完成的测验中出现错误。使用脚本创建表单并使用.setIsQuiz(true)方法将其转换为测验时,“释放标记”设置默认为“稍后,在手动审阅后”。在“表单设置用户界面”中,此选项包括“打开电子邮件收集”注释 - 这样,当手动释放结果时,会有一个用于将结果发送到的电子邮件地址。使用上述步骤创建测验时,不会启用电子邮件收集。这意味着无法手动释放结果。上述解决方法缓解了这个问题。

© www.soinside.com 2019 - 2024. All rights reserved.