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)
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)
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)
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)
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)