2017-06-12 53 views
1

谷歌最近增加了在谷歌Apps腳本編程允許谷歌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); 

編程測驗我想測驗的收件人自動查看自己的得分能力。我沒有看到如何以編程方式做到這一點。而是我需要由龔成測驗設置手動執行此操作,然後將釋放等級爲「提交後,立即」與投訴人可以看到「鬼問題」,「正確答案」,「點值」

是否有可能以編程方式設置這些?

回答

0

這個問題先前被問here(但我的答案尚未upvoted或接受,所以我不能將其標記爲重複)。這是我建議的解決方法:

AFAIAA,目前沒有辦法直接使用Google Apps腳本方法執行此操作。

可能的解決方法是創建一個最小的Google表單,將其作爲測驗,並將其配置爲「每次提交後立即」。不要在腳本中創建表單,只需複製此表單文件(使用腳本),然後繼續以編程方式在副本中構建測驗。

值得注意的是,Google Apps腳本中的這一遺漏可能會導致已完成測驗中的錯誤。當使用腳本創建表單並使用.setIsQuiz(true)方法將其轉化爲測驗時,「發佈標記」設置默認爲「稍後,手動審查後」。在「表單」設置用戶界面中,此選項包含註釋「打開電子郵件收藏」 - 這樣當手動發佈結果時,會有一個電子郵件地址將結果發送到。使用上述步驟創建測驗時,未啓用電子郵件收藏。這意味着無法手動發佈結果。上述解決方法緩解了這個問題。