Skip to content

Commit

Permalink
Load task lists progressively
Browse files Browse the repository at this point in the history
  • Loading branch information
joshsmith committed Nov 6, 2017
1 parent 26ea258 commit 24b0a93
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion lib/code_corps_web/controllers/task_controller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ defmodule CodeCorpsWeb.TaskController do
end
end

@preloads [:comments, :github_pull_request, :task_skills, :user_task]
@preloads [:comments, :github_pull_request, :task_skills, :user, [user_task: :user]]

def preload(data) do
timing("TaskController", "preload") do
Expand Down
9 changes: 5 additions & 4 deletions lib/code_corps_web/views/project_view.ex
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,15 @@ defmodule CodeCorpsWeb.ProjectView do
:total_monthly_donated, :updated_at, :website
]

has_one :organization, serializer: CodeCorpsWeb.OrganizationView, include: true
has_one :organization, type: "organization", field: :organization_id
has_one :stripe_connect_plan, serializer: CodeCorpsWeb.StripeConnectPlanView

has_many :donation_goals, serializer: CodeCorpsWeb.DonationGoalView, identifiers: :always
has_many :project_categories, serializer: CodeCorpsWeb.ProjectCategoryView, include: true
has_many :project_categories, serializer: CodeCorpsWeb.ProjectCategoryView, identifiers: :always
has_many :project_github_repos, serializer: CodeCorpsWeb.ProjectGithubRepoView, identifiers: :always
has_many :project_skills, serializer: CodeCorpsWeb.ProjectSkillView, include: true
has_many :project_users, serializer: CodeCorpsWeb.ProjectUserView, include: true
has_many :project_skills, serializer: CodeCorpsWeb.ProjectSkillView, identifiers: :always
has_many :project_users, serializer: CodeCorpsWeb.ProjectUserView, identifiers: :always
has_many :tasks, serializer: CodeCorpsWeb.TaskView, identifiers: :always
has_many :task_lists, serializer: CodeCorpsWeb.TaskListView, identifiers: :always

def can_activate_donations(project, _conn) do
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.TaskInListView, include: true
has_many :tasks, serializer: CodeCorpsWeb.TaskView, identifiers: :always
end

0 comments on commit 24b0a93

Please sign in to comment.