Skip to content

Commit

Permalink
Fix issue where data from students that are in multiple classes only …
Browse files Browse the repository at this point in the history
…had their data show up in one of them.
  • Loading branch information
Carifio24 committed Nov 8, 2023
1 parent 485d21e commit 5c0fd78
Showing 1 changed file with 3 additions and 2 deletions.
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

0 comments on commit 5c0fd78

Please sign in to comment.