app/controllers/class_lists_controller.rb
# This is a POST for storing all principal revisions.
This is a POST for storing all principal revisions.
This is a POST for storing all principal revisions .
def principal_revised_class_list_json
    params.require(:workspace_id)
    params.require(:principal_revisions_json)
    workspace_id = params[:workspace_id]
    principal_revisions_json = params[:principal_revisions_json]
    latest_class_list = ClassList.latest_class_list_for_workspace(workspace_id)
    raise Exceptions::EducatorNotAuthorized unless latest_class_list.submitted?
    grade_level_now = GradeLevels.new.previous(latest_class_list.grade_level_next_year)
    raise Exceptions::EducatorNotAuthorized unless queries.is_authorized_for_grade_level_now?(latest_class_list.school_id, grade_level_now)
    raise Exceptions::EducatorNotAuthorized unless queries.is_authorized_to_revise?(latest_class_list)
    class_list = latest_class_list.dup
    class_list.update!({
      principal_revisions_json: principal_revisions_json,
      revised_by_principal_educator_id: current_educator.id
    })
    render json: {
      class_list: serialize_class_list(class_list)
    }
  end
def principal_revised_class_list_json params . require ( :workspace_id ) params . require ( :principal_revisions_json ) workspace_id = params [ :workspace_id ] principal_revisions_json = params [ :principal_revisions_json ] latest_class_list = ClassList . latest_class_list_for_workspace ( workspace_id ) raise Exceptions :: EducatorNotAuthorized unless latest_class_list . submitted? grade_level_now = GradeLevels . new . previous ( latest_class_list . grade_level_next_year ) raise Exceptions :: EducatorNotAuthorized unless queries . is_authorized_for_grade_level_now? ( latest_class_list . school_id , grade_level_now ) raise Exceptions :: EducatorNotAuthorized unless queries . is_authorized_to_revise? ( latest_class_list ) class_list = latest_class_list . dup class_list . update! ( { principal_revisions_json : principal_revisions_json , revised_by_principal_educator_id : current_educator . id } ) render json : { class_list : serialize_class_list ( class_list ) } end
This is a POST for storing all principal revisions.
This is a POST for storing all principal revisions .
# The class list must be submitted already # They must be authorized to read it # They must be authorized to revise it # Write a new record