Skip to content

Designate certain learning modules as required - a required learning …#7859

Merged
mehalshah merged 3 commits into
stagingfrom
require_learning_modules
Apr 15, 2016
Merged

Designate certain learning modules as required - a required learning …#7859
mehalshah merged 3 commits into
stagingfrom
require_learning_modules

Conversation

@mehalshah

Copy link
Copy Markdown
Contributor

…module will always be assigned to a user during enrollment

plc_module_assignments.destroy_all

# Make sure the required learning modules are included here
learning_modules |= self.plc_course_unit.plc_learning_modules.where(required: true)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

||= ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, this is intentional. Single pipe is array union

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, TIL. I've seen array_a | array_b before but this is the first time I've seen |=.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, I wonder if this is something we should bake into the EnrollmentUnitAssignment (eager) vs. construct dynamically and allow required modules to be added later (lazy).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://trello.com/c/lxmPIgUB/26-refactoring-module-completion-lazy is on deck and might get pulled into this sprint if we are ahead of schedule


def options_for_evaluation_answer_modules(course_unit)
course_unit.plc_learning_modules.order(:required, :name).map do |learning_module|
# Boo Ruby, you can't add nil to a string without choking?

@joshlory joshlory Apr 14, 2016

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

String interpolation will handle nil values.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@joshlory

joshlory commented Apr 14, 2016

Copy link
Copy Markdown
Contributor

LGTM, with a few nits. Looks like the TravisCI failure is legit.

= text_field_tag ''
%td
= select_tag '', options_for_select(options_for_plc_task_learning_modules), include_blank: ''
= select_tag '', options_for_select(options_for_evaluation_answer_modules(@course_unit)), include_blank: ''

@joshlory joshlory Apr 14, 2016

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe also show " - Required" after the select & save an answer?

screen shot 2016-04-14 at 2 37 43 pm

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do

…module will always be assigned to a user during enrollment

We'll support multiple required learning modules. Spec to come later on how to display required learning modules
@mehalshah mehalshah force-pushed the require_learning_modules branch from 38477db to 513c3ac Compare April 15, 2016 00:52
@mehalshah mehalshah merged commit 618b917 into staging Apr 15, 2016
@mehalshah mehalshah deleted the require_learning_modules branch April 18, 2016 18:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants