Skip to content

Commit

Permalink
Merge pull request #167 from Carifio24/all-data-exclude-null
Browse files Browse the repository at this point in the history
Make sure that we exclude measurements with null values in all data
  • Loading branch information
Carifio24 authored Dec 18, 2024
2 parents f2a0175 + 43ab6c4 commit dc45f33
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/stories/hubbles_law/database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -431,13 +431,21 @@ export async function _getStageThreeStudentData(studentID: number, classID: numb

const MINIMAL_MEASUREMENT_FIELDS = ["student_id", "galaxy_id", "velocity_value", "est_dist_value", "class_id"];

export async function getAllHubbleMeasurements(before: Date | null = null, minimal=false, classID: number | null = null): Promise<HubbleMeasurement[]> {
export async function getAllHubbleMeasurements(before: Date | null = null,
minimal=false,
classID: number | null = null,
excludeWithNull=true): Promise<HubbleMeasurement[]> {
const whereOptions: WhereOptions = [
{ "$student.IgnoreStudents.student_id$": null }
];
if (before !== null) {
whereOptions.push({ last_modified: { [Op.lt]: before } });
}
if (excludeWithNull) {
for (const [key, condition] of Object.entries(EXCLUDE_MEASUREMENTS_WITH_NULL_CONDITION)) {
whereOptions.push({ [key]: condition });
}
}
const classesWhere: WhereOptions<Class> = [];
if (classID !== null) {
const classIDs = await getMergedIDsForClass(classID, true);
Expand Down

0 comments on commit dc45f33

Please sign in to comment.