Skip to content

Instantly share code, notes, and snippets.

@mazz
Created November 2, 2019 20:01
Show Gist options
  • Save mazz/5d7f957c1eae8a7705ff3d787dd3856a to your computer and use it in GitHub Desktop.
Save mazz/5d7f957c1eae8a7705ff3d787dd3856a to your computer and use it in GitHub Desktop.
field `taskcategories` in `select` is a virtual field in schema Db.Schema.Task in query:
query =
from(task in Task,
join: org in Org,
join: rubric in Rubric,
join: coursecode in CourseCode,
join: task_category in TaskCategory,
where: org.uuid == ^org_uuid,
where: org.id == task.org_id,
where: rubric.id == task.rubric_id,
where: coursecode.id == task.coursecode_id,
where: task_category.task_id == task.id,
preload: [taskcategories: :taskitems],
select: %{
title: task.task_title,
uuid: task.uuid,
org_uuid: org.uuid,
archived: task.archived,
course_task_type: task.course_task_type,
task_id: task.id,
rubric: rubric,
coursecode: coursecode,
task_category: task.taskcategories,
inserted_at: task.inserted_at,
updated_at: task.updated_at,
hash_id: task.hash_id
}
)
@tblevins-pv
Copy link

What was the issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment