Skip to content
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

Fix issue with students in multiple classes #97

Merged
merged 1 commit into from
Nov 8, 2023
Merged
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
5 changes: 3 additions & 2 deletions src/stories/hubbles_law/database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,7 @@ export async function getAllHubbleMeasurements(before: Date | null = null): Prom
whereConditions.push({ last_modified: { [Op.lt]: before } });
}
return HubbleMeasurement.findAll({
raw: true,
attributes: {
// The "student" here comes from the alias below
// We do this so that we get access to the included field as just "class_id"
Expand All @@ -397,11 +398,11 @@ export async function getAllHubbleMeasurements(before: Date | null = null): Prom
include: [{
model: Galaxy,
as: "galaxy",
attributes: ["id", "type"]
attributes: []
}, {
model: Student,
as: "student",
attributes: ["seed", "dummy"],
attributes: [],
where: {
[Op.or]: [
{ seed: 1 }, { dummy: 0 }
Expand Down