ami_models v0.2.1 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
add_lesson_title_and_id(arg)
add_score_value(arg, enrollment)
add_took_exam_flag(arg)
assignment_rating_changeset(struct, params \\ %{})
Builds a changeset for saving assignment rating (aka assignment-score)
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
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.
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
course_is_completed?(enrollment)
course_passed?(enrollment)
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
create_base_tuple(quiz, unit_id)
Helper functions pipeline building enrollment quizzes status stored in enrollment.progress
days_from_ending?(enrollment, countdown)
delete_associated_datas_of(enrollment)
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
fetch_final_exam_query(course)
Query responsible for fetching course final quiz Bindings are : q - Quiz / l - Lesson / u - Unit
fetch_final_exam_query_with_grade_value(course)
fetch_final_unit_query(course)
Query responsible for fetching a given course final unit
fetch_finalexam_score_query(final_exam_id, enrollment)
Query responsible for fetching the final quiz score for a given enrollment Bindings are : s - Score
fetch_score_for(quiz_id, enrollment)
fetch_unit_tests_query(course)
Query responsible for fetching a given course unit tests Bindings are : u - Unit / l - Lesson / q - Quiz
final_assignment_reviewed?(progress_map, enrollment)
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
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
get_community_enrollment_archive_for(map, user_struct)
get_community_enrollments_for(user_struct)
get_current_enrollments_for(user_struct)
get_learninglab_enrollment_archive_for(map, user_struct)
get_learninglab_enrollments_for(user_struct)
get_notarchived_completed_enrollments_for(user_struct)
get_notcompleted_community_enrollments_for(user_struct)
get_notcompleted_public_enrollments_for(user_struct)
get_package_enrollment_archive_for(map, user_struct)
get_package_enrollments_for(user_struct)
get_public_enrollment_archive_for(map, user_struct)
get_public_enrollments_for(user_struct)
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
get_unit_graded_quiz(unit_id)
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
into_community_cp?(user_struct)
into_learning_lab?(user_struct)
into_package?(user_struct)
mark_as_archived(enrollment)
other_cp_students(course_period, user)
package_period_changeset(enrollment, params \\ %{})
Builds a changeset for creating a package enrollment with package_period_id uniqueness validation scoped by user_id
potential_buddy_ids_for(course_period, enrollment)
potential_buddy_ids_for(course_period, course_period, enrollment)
potential_buddy_ids_for(users_list, atom, course_period, enrollment)
preassessment_quiz_query(course)
Query fetching the preassessment quiz of a given course Bindings are : [q,l,u]
preload_resources(struct)
Pattern to fetch resources as lesson.resources with resourceable_type == "Enrollment"
prepend_to_list(list, list)
progress_for(enrollment)
remaining_assessments(enrollment)
test_results_query(enrollment)
type_of(enrollment)
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
update(enrollment, params \\ %{})
update_course_flags(enrollment)
Update enrollment's course flags (started, completed, passed_on) based enrollment scores and assignment status