Skip to content

Include tasks in task_list view #1146

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/code_corps_web/controllers/task_list_controller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ defmodule CodeCorpsWeb.TaskListController do
end
end

@preloads [:tasks]
@preloads [{:tasks, [:comments, :github_pull_request, :task_skills, :user_task]}]
Copy link
Contributor Author

@snewcomer snewcomer Nov 2, 2017

Choose a reason for hiding this comment

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

This is using nested preloads. I am not sure if we should just add the whole list of task preloads or not. Was just adding them based on the feedback from the tests. @begedin thoughts?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ah these are the ones marked with identifier: always

Copy link
Contributor Author

@snewcomer snewcomer Nov 3, 2017

Choose a reason for hiding this comment

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

@joshsmith would you also include the task's relationships?

Copy link
Contributor

Choose a reason for hiding this comment

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

The real answer here is that it doesn't much matter what I think, but what the performance implications are. Testing this out in the browser with Scout running and doing more precise benchmarking will combined yield a better answer.


def preload(data) do
Repo.preload(data, @preloads)
Expand Down
2 changes: 1 addition & 1 deletion lib/code_corps_web/views/task_list_view.ex
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ defmodule CodeCorpsWeb.TaskListView do

has_one :project, type: "project", field: :project_id

has_many :tasks, serializer: CodeCorpsWeb.TaskView, identifiers: :always
has_many :tasks, serializer: CodeCorpsWeb.TaskView, include: true, identifiers: :always
end
Loading