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

Make sure that we exclude measurements with null values in all data #167

Merged
merged 1 commit into from
Dec 18, 2024
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
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
Loading