Exemplo n.º 1
0
def user_all_homework_completion_rate(user_id):
    """Summary

    Args:
        user_id (TYPE): Description

    Returns:
        TYPE: Description
    """
    assignment_logs = db.assignment_logs
    class_assignments = db.with_labels(db.class_assignments)
    join = db.join(
        class_assignments, assignment_logs, assignment_logs.assignment_id == class_assignments.class_assignments_id
    )
    complete = join.filter(
        class_assignments.class_assignments_assignment_type_id == 1,
        assignment_logs.user_id == user_id,
        assignment_logs.end_time != None,
    ).count()
    incomplete = join.filter(
        class_assignments.class_assignments_assignment_type_id == 1,
        assignment_logs.user_id == user_id,
        assignment_logs.end_time == None,
    ).count()
    return get_performance(complete, incomplete)
Exemplo n.º 2
0
def user_all_class_assignment_performance(user_id):
    """Summary

    Args:
        user_id (TYPE): Description

    Returns:
        TYPE: Description
    """
    problem_logs = db.problem_logs
    class_assignments = db.with_labels(db.class_assignments)
    join = db.join(
        class_assignments, problem_logs, problem_logs.assignment_id == class_assignments.class_assignments_id
    )
    correct = join.filter(
        class_assignments.class_assignments_assignment_type_id == 1,
        problem_logs.correct == 1,
        problem_logs.original == 1,
        problem_logs.user_id == user_id,
    ).count()
    incorrect = join.filter(
        class_assignments.class_assignments_assignment_type_id == 1,
        problem_logs.correct < 1,
        problem_logs.original == 1,
        problem_logs.user_id == user_id,
    ).count()
    return get_performance(correct, incorrect)
Exemplo n.º 3
0
def arrs_enable_class_num():
    """Summary

    Returns:
        TYPE: Description
    """
    arrs = db.student_reassessment_records
    classes = db.with_labels(db.student_classes)
    join = db.join(arrs, classes,
                   arrs.student_class_id == classes.student_classes_id)
    where = classes.student_classes_enabled == True
    return join.filter(where).distinct(arrs.student_class_id).count()
Exemplo n.º 4
0
def skill_builder_problem_set_num():
    """Summary

    Returns:
        TYPE: Description
    """
    sequences = db.sequences
    sections = db.with_labels(db.sections)
    join = db.join(sequences, sections, sequences.head_section_id == sections.sections_id)
    where = sections.sections_type == "MasterySection"
    result = join.filter(where).count()
    return result
Exemplo n.º 5
0
def skill_builder_problem_set_num():
    """Summary

    Returns:
        TYPE: Description
    """
    sequences = db.sequences
    sections = db.with_labels(db.sections)
    join = db.join(sequences, sections,
                   sequences.head_section_id == sections.sections_id)
    where = sections.sections_type == 'MasterySection'
    result = join.filter(where).count()
    return result
Exemplo n.º 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)
Exemplo n.º 7
0
def user_reassessment_performance(user_id):
    """Summary

    Args:
        user_id (TYPE): Description

    Returns:
        TYPE: Description
    """
    res_prbs = db.student_reassessment_problems
    problem_logs = db.with_labels(db.problem_logs)
    join = db.join(res_prbs, problem_logs,
                   res_prbs.problem_log_id == problem_logs.problem_logs_id)
    where = res_prbs.student_id == user_id_to_student_id(user_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_performance(correct, incorrect)
Exemplo n.º 8
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)
Exemplo n.º 9
0
def user_all_homework_completion_rate(user_id):
    """Summary

    Args:
        user_id (TYPE): Description

    Returns:
        TYPE: Description
    """
    assignment_logs = db.assignment_logs
    class_assignments = db.with_labels(db.class_assignments)
    join = db.join(
        class_assignments, assignment_logs, assignment_logs.assignment_id ==
        class_assignments.class_assignments_id)
    complete = join.filter(
        class_assignments.class_assignments_assignment_type_id == 1,
        assignment_logs.user_id == user_id,
        assignment_logs.end_time != None).count()
    incomplete = join.filter(
        class_assignments.class_assignments_assignment_type_id == 1,
        assignment_logs.user_id == user_id,
        assignment_logs.end_time == None).count()
    return get_performance(complete, incomplete)
Exemplo n.º 10
0
def user_all_class_assignment_performance(user_id):
    """Summary

    Args:
        user_id (TYPE): Description

    Returns:
        TYPE: Description
    """
    problem_logs = db.problem_logs
    class_assignments = db.with_labels(db.class_assignments)
    join = db.join(
        class_assignments, problem_logs,
        problem_logs.assignment_id == class_assignments.class_assignments_id)
    correct = join.filter(
        class_assignments.class_assignments_assignment_type_id == 1,
        problem_logs.correct == 1, problem_logs.original == 1,
        problem_logs.user_id == user_id).count()
    incorrect = join.filter(
        class_assignments.class_assignments_assignment_type_id == 1,
        problem_logs.correct < 1, problem_logs.original == 1,
        problem_logs.user_id == user_id).count()
    return get_performance(correct, incorrect)