ami_models v0.2.9 Ami.Enrollment

Link to this section Summary

Functions

Builds a changeset for saving assignment rating (aka assignment-score)

Calculate an enrollment's final grade, according to following rules

Progress overview for a course : calculate progress percentage based on how many unit exams has been done along with the final exam. Provide a keyword list of all graded exams status for helping in setting stars status on progress bar.

Calculate the enrollment progress percentage following this rule/formula 1 - calculate the unit test pcentage value

Builds a changeset creating a course enrollment

Helper functions pipeline building enrollment quizzes status stored in enrollment.progress

Count the enrollment's done unit tests and add it to the progress map under the key :completed_unit_test

Query responsible for fetching course final quiz Bindings are : q - Quiz / l - Lesson / u - Unit

Query responsible for fetching a given course final unit

Query responsible for fetching the final quiz score for a given enrollment Bindings are : s - Score

Query responsible for fetching a given course unit tests Bindings are : u - Unit / l - Lesson / q - Quiz

Check wether or not the user succeeded this enrollment final exam and add the result to the progress map under key :accepted_final_exam

Builds a map containing all enrollments archive for a given user Keys are: :community_enrollments, :public_enrollments, :learninglab_enrollments

Count the enrollment's course unit tests and add it to the progress map under the key :unit_test_count

Check if user has taken the course final exam or not, and add the check result to the progress_map under key :passed_final_exam

Builds a changeset for creating a package enrollment with package_period_id uniqueness validation scoped by user_id

Query fetching the preassessment quiz of a given course Bindings are : [q,l,u]

Pattern to fetch resources as lesson.resources with resourceable_type == "Enrollment"

Return an ordered by unit_id list tuples in the form [{ unit_id, 1(true)/0(false)}, idx }, {{},idx2}, …] where 1/0 stands for wether the user has done the unit test

Update enrollment's course flags (started, completed, passed_on) based enrollment scores and assignment status

Link to this section Functions

Link to this function

add_lesson_title_and_id(arg)

Link to this function

add_score_value(arg, enrollment)

Link to this function

add_took_exam_flag(arg)

Link to this function

assignment_rating_changeset(struct, params \\ %{})

Builds a changeset for saving assignment rating (aka assignment-score)

Link to this function

calculate_global_result(enrollment)

Calculate an enrollment's final grade, according to following rules :

  • 40% for accepted assignment
  • 40% of final exam score
  • 20% of unit test scores average
Link to this function

calculate_progress(enrollment)

Progress overview for a course : calculate progress percentage based on how many unit exams has been done along with the final exam. Provide a keyword list of all graded exams status for helping in setting stars status on progress bar.

Link to this function

calculate_progress_percentage(progress_map)

Calculate the enrollment progress percentage following this rule/formula 1 - calculate the unit test pcentage value :

    50.0 / unit tests count
    50.0 if unit test count = 0

2 - add 25 if user has passed final exam 3 - add 25 if user has succeeded final exam Add the calculated percentage to the progress map under key :pcentage

Link to this function

course_is_completed?(enrollment)

Link to this function

course_passed?(enrollment)

Link to this function

course_period_changeset(enrollment_struct, params \\ %{}, course_period)

Builds a changeset creating a course enrollment

  • validates presence of course_period_id and user_id foreign keys
  • validates with course_period_id uniqueness scoped by user_id
  • check if user belongs to course period's community when it's a community course period
Link to this function

create_base_tuple(quiz, unit_id)

Helper functions pipeline building enrollment quizzes status stored in enrollment.progress

Link to this function

days_from_ending?(enrollment, countdown)

Link to this function

delete_associated_datas_of(enrollment)

Link to this function

done_unit_test_count(progress_map, enrollment)

Count the enrollment's done unit tests and add it to the progress map under the key :completed_unit_test

Link to this function

fetch_final_exam_query(course)

Query responsible for fetching course final quiz Bindings are : q - Quiz / l - Lesson / u - Unit

Link to this function

fetch_final_exam_query_with_grade_value(course)

Link to this function

fetch_final_unit_query(course)

Query responsible for fetching a given course final unit

Link to this function

fetch_finalexam_score_query(final_exam_id, enrollment)

Query responsible for fetching the final quiz score for a given enrollment Bindings are : s - Score

Link to this function

fetch_score_for(quiz_id, enrollment)

Link to this function

fetch_unit_tests_query(course)

Query responsible for fetching a given course unit tests Bindings are : u - Unit / l - Lesson / q - Quiz

Link to this function

final_assignment_reviewed?(progress_map, enrollment)

Link to this function

finished_course?(progress_map, enrollment)

Check wether or not the user succeeded this enrollment final exam and add the result to the progress map under key :accepted_final_exam

Link to this function

get_archive_enrollments_for(user_struct)

Builds a map containing all enrollments archive for a given user Keys are: :community_enrollments, :public_enrollments, :learninglab_enrollments

Link to this function

get_community_enrollment_archive_for(map, user_struct)

Link to this function

get_community_enrollments_for(user_struct)

Link to this function

get_current_enrollments_for(user_struct)

Link to this function

get_learninglab_enrollment_archive_for(map, user_struct)

Link to this function

get_learninglab_enrollments_for(user_struct)

Link to this function

get_notarchived_completed_enrollments_for(user_struct)

Link to this function

get_notcompleted_community_enrollments_for(user_struct)

Link to this function

get_notcompleted_public_enrollments_for(user_struct)

Link to this function

get_package_enrollment_archive_for(map, user_struct)

Link to this function

get_package_enrollments_for(user_struct)

Link to this function

get_public_enrollment_archive_for(map, user_struct)

Link to this function

get_public_enrollments_for(user_struct)

Link to this function

get_unit_exam_count(progress_map, enrollment)

Count the enrollment's course unit tests and add it to the progress map under the key :unit_test_count

Link to this function

get_unit_graded_quiz(unit_id)

Link to this function

has_passed_final_exam?(progress_map, enrollment)

Check if user has taken the course final exam or not, and add the check result to the progress_map under key :passed_final_exam

Link to this function

into_community_cp?(user_struct)

Link to this function

into_learning_lab?(user_struct)

Link to this function

into_package?(user_struct)

Link to this function

mark_as_archived(enrollment)

Link to this function

other_cp_students(course_period, user)

Link to this function

package_period_changeset(enrollment, params \\ %{})

Builds a changeset for creating a package enrollment with package_period_id uniqueness validation scoped by user_id

Link to this function

potential_buddy_ids_for(course_period, enrollment)

Link to this function

potential_buddy_ids_for(course_period, course_period, enrollment)

Link to this function

potential_buddy_ids_for(users_list, atom, course_period, enrollment)

Link to this function

preassessment_quiz_query(course)

Query fetching the preassessment quiz of a given course Bindings are : [q,l,u]

Link to this function

preload_resources(struct)

Pattern to fetch resources as lesson.resources with resourceable_type == "Enrollment"

Link to this function

prepend_to_list(list, list)

Link to this function

progress_for(enrollment)

Link to this function

remaining_assessments(enrollment)

Link to this function

test_results_query(enrollment)

Link to this function

type_of(enrollment)

Link to this function

unit_tests_attempt_status(progress_map, enrollment)

Return an ordered by unit_id list tuples in the form [{ unit_id, 1(true)/0(false)}, idx }, {{},idx2}, …] where 1/0 stands for wether the user has done the unit test

Link to this function

update(enrollment, params \\ %{})

Link to this function

update_course_flags(enrollment)

Update enrollment's course flags (started, completed, passed_on) based enrollment scores and assignment status

Link to this function

update_is_archived(enrollment)

Link to this function

update_progress(enrollment)