本文整理汇总了Python中models.Question.select方法的典型用法代码示例。如果您正苦于以下问题:Python Question.select方法的具体用法?Python Question.select怎么用?Python Question.select使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Question
的用法示例。
在下文中一共展示了Question.select方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from models import Question [as 别名]
# 或者: from models.Question import select [as 别名]
def main(*args, **kwargs):
for question in Question.select():
comparison_title = "Task " + str(question.question_index) + " package comparison"
confidence_title = "Task " + str(question.question_index) + " confidence"
yield [
[question.user_id, comparison_title, question.na_likert_comparison_evidence],
[question.user_id, confidence_title, question.na_likert_confidence],
]
for comparison in PackageComparison.select():
yield [
[comparison.user_id, "Preference " + comparison.stage, comparison.na_likert_preference],
[comparison.user_id, "Documentation Quality " + comparison.stage,
comparison.na_likert_quality_documentation],
[comparison.user_id, "Community Quality " + comparison.stage,
comparison.na_likert_quality_community],
]
for postquestionnaire in Postquestionnaire.select():
yield [
[postquestionnaire.user_id, "Perception Change",
postquestionnaire.na_likert_perception_change]
]
raise StopIteration
示例2: main
# 需要导入模块: from models import Question [as 别名]
# 或者: from models.Question import select [as 别名]
def main(*args, **kwargs):
# Fetch distinct user IDs from the question data
user_ids = [
question.user_id for question in
Question.select(Question.user_id).group_by(Question.user_id)
]
# Yield a record of all participant responses for each participant
for user_id in user_ids:
# Build a new blank record for this participant that we can index by concern index.
user_record = {
'strategies': ["No response." for _ in range(len(CONCERNS_SHORTHAND))],
'evidence': ["No response." for _ in range(len(CONCERNS_SHORTHAND))],
}
# Fetch a reference to the pair of packages that the participant used
package_pair = PackagePair.select().where(PackagePair.user_id == user_id).first()
# Save all of the "evidence" question responses, in concern order
for question in Question.select().where(Question.user_id == user_id):
concern_index = _get_concern_index(user_id, question.question_index)
user_record['evidence'][concern_index] = question.evidence
# Save all of the "strategy" question responses, in concern order
for strategy in Strategy.select().where(Strategy.user_id == user_id):
concern_index = _get_concern_index(user_id, strategy.question_index)
user_record['strategies'][concern_index] = strategy.strategy
# Assemble and return a single row of a CSV file for the user
response_list = [
"Search study responses",
"Participant " + str(user_id),
package_pair.package1,
package_pair.package2,
]
response_list.extend(user_record['strategies'])
response_list.extend(user_record['evidence'])
yield [response_list]
raise StopIteration
示例3: main
# 需要导入模块: from models import Question [as 别名]
# 或者: from models.Question import select [as 别名]
def main(*args, **kwargs):
for question in Question.select():
concern_index = _get_concern_index(question.user_id, question.question_index)
yield [[
question.user_id,
question.question_index,
concern_index,
question.concern,
question.likert_confidence,
]]
raise StopIteration