当前位置: 首页>>代码示例>>Python>>正文


Python Question.select方法代码示例

本文整理汇总了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
开发者ID:andrewhead,项目名称:Search-Task-Analysis,代码行数:28,代码来源:na_responses.py

示例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
开发者ID:andrewhead,项目名称:Search-Task-Analysis,代码行数:44,代码来源:open_responses.py

示例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
开发者ID:andrewhead,项目名称:Search-Task-Analysis,代码行数:15,代码来源:confidence_ratings.py


注:本文中的models.Question.select方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。