Questionnaire
Updated: 2022-08-16 14:47:23
Feature Overview
- This SDK primarily includes functions for managing questionnaire data and starting questionnaire interactions. The following operations are only supported for users with the role of instructor/guest/teaching assistant/administrator.
- Questionnaire question types can be divided into multiple-choice questions and open-ended questions.
- Multiple-choice questions are further divided into single-choice and multiple-choice questions, with options to set them as mandatory and assign scores.
- Open-ended questions: Can be set as mandatory but cannot have scores assigned.
- Questionnaire Management
- Supports adding and deleting questionnaires.
- Provides a questionnaire import function, allowing users to download a default template, edit it, and re-upload it.
- Allows publishing, stopping, and sending questionnaire results.
- Retrieves a list of previously published questionnaires and their details.
- Obtains the number of submissions within a room.
- Downloads questionnaire statistical results.
Quantity Limits
During development, ensure compliance with the following limits; otherwise, API requests will fail.
- Maximum number of questions per questionnaire: 100
- Each single-choice/multiple-choice question must have between 2 and 10 options.
- Character limits. Note that each non-English character occupies 2 characters, e.g., "中文abc" counts as 7 characters.
- Questionnaire name: 60
- Option content: 400
- Question content: 500
Basic Flow
1. new Questionnaire()
const app = new InteractionsLaunchSDK.Questionnaire();
// 注册监听事件 在 Polyv 聊天室连接成功后,立即调用 `on()` 注册监听事件。
app
// 成功广播开始问卷消息后,`'start'` 事件被触发,执行回调。
.on('start', this.handleStart)
// 收到问卷结束消息后, `'stop'`件被触发,执行回调 。
.on('stop', this.handleStop)
// 每次观众提交回答, `'answer'` 事件都会被触发一次,执行回调。
.on('answer', this.handleAnswer)
// 调用 `app.sendResult()` `'show-result'` 事件触发,执行回调。
.on('show-result', this.handleShowResult);
// 上传问卷数据。
app.uploadTemplate(file);
// 编辑或创建问卷。
app.save(questionnaire);
// 发起问卷。
app.start(questionnaireData);
// 分页获取问卷列表,可以获取到某个频道号下的所有问卷,列表中问卷状态值为 `'published'` 的是正在进行的问卷。
app.getQuestionnairePageList({pageNumber, pageSize});
// 获取问卷详情。包括问卷基本信息、问卷题目列表、提交结果统计数据(如果问卷已结束)。
app.getQuestionnaireDetail(questionnaireId);
