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 station filter logic for nodes having no children. #232

Merged
merged 2 commits into from
Mar 15, 2023
Merged

Conversation

junghao
Copy link
Contributor

@junghao junghao commented Feb 21, 2023

As requested in https://github.com/GeoNet/tickets/issues/12671.
Also, text output will be in sync with XML output GeoNet/help#103.

Previously we deliberately make it not exists, so the fix is remove those extras.

@junghao junghao requested a review from CallumNZ February 21, 2023 01:40
Copy link
Contributor

@CallumNZ CallumNZ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just some variable names that are hard to understand.

Comment on lines 629 to 632
nNet := len(r.Network)
r.Network = ns

if len(ns) == 0 {
// No result ( no "Network" node )
if nNet != 0 && len(ns) == 0 {
// this means the query has network parameter but idn't match one, we want to give a no data
return false
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nNet is strange.
Can ns be networks ? or better yet filteredNetworks.

Would a defer r.Network = ns help, just after for loop? Also for station/channel sections.

Comment missing a d in didn't

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's still trimLevel need to operate on the result slice. So can't move the assignment to defer.

CallumNZ
CallumNZ previously approved these changes Feb 21, 2023
@junghao
Copy link
Contributor Author

junghao commented Feb 24, 2023

@CallumNZ I found that the logic was incorrect. Could you please review my new update?

Thanks

CallumNZ
CallumNZ previously approved these changes Feb 27, 2023
Copy link
Contributor

@CallumNZ CallumNZ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

for _, p := range matchedParams {
if p.StationReg == nil && p.ChannelReg == nil && p.LocationReg == nil {
return true
if p.StationReg != nil && !contains(p.StationReg, REGEX_ANYTHING) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does the regex check add?

Copy link
Contributor Author

@junghao junghao Mar 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See Jerome's comment regarding issue with WTSZ here https://github.com/GeoNet/tickets/issues/12671#issuecomment-1452655370

Short answer is : "*" includes "0 results".

@junghao junghao requested a review from CallumNZ March 15, 2023 01:27
Copy link
Contributor

@CallumNZ CallumNZ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

@sue-h-gns sue-h-gns merged commit 4a2a5af into main Mar 15, 2023
@sue-h-gns sue-h-gns deleted the fix-filter branch March 15, 2023 02:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants