Пример #1
0
def main_problem_difficulty():
    """Summary

    Returns:
        TYPE: Description
    """
    correct = db.problem_logs.filter(db.problem_logs.correct == 1, db.problem_logs.original == 1).count()
    incorrect = db.problem_logs.filter(db.problem_logs.correct < 1, db.problem_logs.original == 1).count()
    return get_difficulty(correct, incorrect)
Пример #2
0
def all_problem_difficulty():
    """Summary

    Returns:
        TYPE: Description
    """
    correct = db.problem_logs.filter(db.problem_logs.correct == 1).count()
    incorrect = db.problem_logs.filter(db.problem_logs.correct < 1).count()
    return get_difficulty(correct, incorrect)
Пример #3
0
def problem_difficulty(problem_id):
    """Summary

    Args:
        problem_id (TYPE): Description

    Returns:
        TYPE: Description
    """
    table = db.problem_logs
    correct = table.filter(table.correct == 1, table.original == 1, table.problem_id == problem_id).count()
    incorrect = table.filter(table.correct < 1, table.original == 1, table.problem_id == problem_id).count()
    return get_difficulty(correct, incorrect)
Пример #4
0
def problem_difficulty(problem_id):
    """Summary

    Args:
        problem_id (TYPE): Description

    Returns:
        TYPE: Description
    """
    table = db.problem_logs
    correct = table.filter(table.correct == 1, table.original == 1,
                           table.problem_id == problem_id).count()
    incorrect = table.filter(table.correct < 1, table.original == 1,
                             table.problem_id == problem_id).count()
    return get_difficulty(correct, incorrect)
Пример #5
0
def problem_set_difficulty(sequence_id):
    """Summary

    Args:
        sequence_id (TYPE): Description

    Returns:
        TYPE: Description
    """
    class_assignments = db.class_assignments
    problem_logs = db.with_labels(db.problem_logs)
    join = db.join(class_assignments, problem_logs, class_assignments.id == problem_logs.problem_logs_assignment_id)
    where = and_(problem_logs.problem_logs_original == 1, class_assignments.sequence_id == sequence_id)
    correct = join.filter(where, problem_logs.problem_logs_correct == 1).count()
    incorrect = join.filter(where, problem_logs.problem_logs_correct < 1).count()
    return get_difficulty(correct, incorrect)
Пример #6
0
def problem_set_difficulty(sequence_id):
    """Summary

    Args:
        sequence_id (TYPE): Description

    Returns:
        TYPE: Description
    """
    class_assignments = db.class_assignments
    problem_logs = db.with_labels(db.problem_logs)
    join = db.join(
        class_assignments, problem_logs,
        class_assignments.id == problem_logs.problem_logs_assignment_id)
    where = and_(problem_logs.problem_logs_original == 1,
                 class_assignments.sequence_id == sequence_id)
    correct = join.filter(where,
                          problem_logs.problem_logs_correct == 1).count()
    incorrect = join.filter(where,
                            problem_logs.problem_logs_correct < 1).count()
    return get_difficulty(correct, incorrect)