Skip to content

Instantly share code, notes, and snippets.

@talum talum/sti_1a.rb
Last active Nov 25, 2018

Embed
What would you like to do?
STI examples
def completed_labs_count(student, canonical_repo_ids)
if $rollout.active?(:remove_content)
student.canonical_progresses.complete.
joins(github_repository: :canonical_material).
where(github_repository_id: canonical_repo_ids).
where(kind: CourseWork::CanonicalMaterial::LAB_KINDS).
uniq(:id).
count
else
student.canonical_progresses.complete.
joins(github_repository: :contents).
where(github_repository_id: canonical_repo_ids).
where(contents: { type: 'Lab' }).
uniq(:id).
count
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.