-
Notifications
You must be signed in to change notification settings - Fork 22
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
just modifying the breakpoints for all the index endpoints #3843
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -80,8 +80,12 @@ const generateFilter = { | |||||||||||||||||||||||||||
if (!index) { | ||||||||||||||||||||||||||||
delete filter["values.pm2_5.value"]; | ||||||||||||||||||||||||||||
} else if (Object.keys(constants.AQI_INDEX).includes(index)) { | ||||||||||||||||||||||||||||
filter["values.pm2_5.value"]["$gte"] = constants.AQI_INDEX[index][0]; | ||||||||||||||||||||||||||||
filter["values.pm2_5.value"]["$lte"] = constants.AQI_INDEX[index][1]; | ||||||||||||||||||||||||||||
const range = constants.AQI_INDEX[index]; | ||||||||||||||||||||||||||||
filter["values.pm2_5.value"]["$gte"] = range.min; | ||||||||||||||||||||||||||||
// Only set $lte if max is not null | ||||||||||||||||||||||||||||
if (range.max !== null) { | ||||||||||||||||||||||||||||
filter["values.pm2_5.value"]["$lte"] = range.max; | ||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||
Comment on lines
+83
to
+88
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Initialize 'filter["values.pm2_5.value"]' before assigning properties To prevent potential runtime errors, please ensure that Apply this diff to fix the issue: + filter["values.pm2_5.value"] = {};
filter["values.pm2_5.value"]["$gte"] = range.min;
// Only set $lte if max is not null
if (range.max !== null) {
filter["values.pm2_5.value"]["$lte"] = range.max;
} 📝 Committable suggestion
Suggested change
|
||||||||||||||||||||||||||||
filter["index"] = index; | ||||||||||||||||||||||||||||
} else { | ||||||||||||||||||||||||||||
delete filter["values.pm2_5.value"]; | ||||||||||||||||||||||||||||
|
@@ -341,8 +345,13 @@ const generateFilter = { | |||||||||||||||||||||||||||
if (!index) { | ||||||||||||||||||||||||||||
delete filter["values.pm2_5.value"]; | ||||||||||||||||||||||||||||
} else if (Object.keys(constants.AQI_INDEX).includes(index)) { | ||||||||||||||||||||||||||||
filter["values.pm2_5.value"]["$gte"] = constants.AQI_INDEX[index][0]; | ||||||||||||||||||||||||||||
filter["values.pm2_5.value"]["$lte"] = constants.AQI_INDEX[index][1]; | ||||||||||||||||||||||||||||
const range = constants.AQI_INDEX[index]; | ||||||||||||||||||||||||||||
filter["values.pm2_5.value"] = {}; | ||||||||||||||||||||||||||||
filter["values.pm2_5.value"]["$gte"] = range.min; | ||||||||||||||||||||||||||||
// Only set $lte if max is not null | ||||||||||||||||||||||||||||
if (range.max !== null) { | ||||||||||||||||||||||||||||
filter["values.pm2_5.value"]["$lte"] = range.max; | ||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||
filter["index"] = index; | ||||||||||||||||||||||||||||
} else { | ||||||||||||||||||||||||||||
delete filter["values.pm2_5.value"]; | ||||||||||||||||||||||||||||
|
@@ -670,8 +679,13 @@ const generateFilter = { | |||||||||||||||||||||||||||
if (!index) { | ||||||||||||||||||||||||||||
delete filter["values.pm2_5.value"]; | ||||||||||||||||||||||||||||
} else if (Object.keys(constants.AQI_INDEX).includes(index)) { | ||||||||||||||||||||||||||||
filter["values.pm2_5.value"]["$gte"] = constants.AQI_INDEX[index][0]; | ||||||||||||||||||||||||||||
filter["values.pm2_5.value"]["$lte"] = constants.AQI_INDEX[index][1]; | ||||||||||||||||||||||||||||
const range = constants.AQI_INDEX[index]; | ||||||||||||||||||||||||||||
filter["values.pm2_5.value"] = {}; | ||||||||||||||||||||||||||||
filter["values.pm2_5.value"]["$gte"] = range.min; | ||||||||||||||||||||||||||||
// Only set $lte if max is not null | ||||||||||||||||||||||||||||
if (range.max !== null) { | ||||||||||||||||||||||||||||
filter["values.pm2_5.value"]["$lte"] = range.max; | ||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||
filter["index"] = index; | ||||||||||||||||||||||||||||
} else { | ||||||||||||||||||||||||||||
delete filter["values.pm2_5.value"]; | ||||||||||||||||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codebase verification
🛠️ Refactor suggestion
Data structure updated, but range boundaries and category naming require attention
The AQI_INDEX structure has been improved for clarity. However, please address the following:
🔗 Analysis chain
Improved data structure, but ranges need verification
The transition from array-based to object-based structure with explicit
min
andmax
values improves clarity and maintainability. However, let's verify a few critical aspects:Consider these improvements:
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
Length of output: 1902
Script:
Length of output: 634