Created
June 2, 2018 01:20
-
-
Save talum/b0bac571b01459b653a17ed619f2af35 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Assignments | |
# This code lives in a module that we use to namespace our application as part of domain-driven design. You might call this an aggregate root. | |
def self.update_assignment(assignment_id, title:, description:, collaborator_ids:, assignee_ids:, tasks:, due_in:, due_in_units:) | |
assignment = Assignment | |
.includes(tasks: :rubric_items) | |
.find(assignment_id) | |
assignment.update( | |
title: title, | |
description: description, | |
due_in: due_in, | |
due_in_units: due_in_units | |
) | |
assignment.set_tasks_from_list(tasks) | |
assignment.set_collaborators_from_list(collaborator_ids) | |
assignment.assign(assignee_ids) | |
assignment.save | |
PublishableAssignmentValidation.new(assignment).validate | |
AssignmentManagementView.render_assignment_details(assignment) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment