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

Convert ANALYSIS_COORDINATE_SYSTEM_SRID to int in map_filter #11715

Merged

Conversation

SDScandrettKint
Copy link
Member

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Description of Change

Simple fix to convert ANALYSIS_COORDINATE_SYSTEM_SRID to int.

Not sure if this fix is sufficient, or whether I should go with the approach of below, just in case the settings value for ANALYSIS_COORDINATE_SYSTEM_SRID is incorrect and can't be converted to an int (as this fix could cause another problem).

    try:
        analysis_coord_system_srid = int(settings.ANALYSIS_COORDINATE_SYSTEM_SRID)
    except Exception:
        analysis_coord_system_srid = 3857 # revert to default value

Issues Solved

Closes #11714

Checklist

  • I targeted one of these branches:
    • dev/8.0.x (under development): features, bugfixes not covered below
    • dev/7.6.x (main support): regressions, crashing bugs, security issues, major bugs in new features
    • dev/6.2.x (extended support): major security issues, data loss issues
  • I added a changelog in arches/releases
  • I submitted a PR to arches-docs (if appropriate)
  • Unit tests pass locally with my changes
  • I added tests that prove my fix is effective or that my feature works
  • My test fails on the target branch

Accessibility Checklist

Developer Guide

Topic Changed Retested
Color contrast
Form fields
Headings
Links
Keyboard
Responsive Design
HTML validation
Screen reader

Ticket Background

Further comments

@SDScandrettKint SDScandrettKint self-assigned this Jan 6, 2025
@SDScandrettKint SDScandrettKint requested a review from chiatt January 6, 2025 23:05
Copy link
Member

@chiatt chiatt left a comment

Choose a reason for hiding this comment

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

Could you include an entry in the changelog?

Also, regarding your comment about using 3857 if the SRID isn't an int - if it can't be converted to an integer, then I think we want it to break rather than do the calculation with a different SRID. Using 3857 instead of the SRID the user thinks they are using might cause unexpected behavior.

@SDScandrettKint
Copy link
Member Author

@chiatt Changelog entry added in 94f34cc.

I agree with the reasons why the search should break rather than use the default SRID value.

Also in the commit, I added a raise error, as currently the error produced can come across as unhelpful:
image

The new error prevents the search and informs the user that their value isn't a number because cannot be converted to int:
image

This can be tested by setting ANALYSIS_COORDINATE_SYSTEM_SRID to a value like "test".

Does this seem like a helpful improvement?

@SDScandrettKint
Copy link
Member Author

I see coverage has decreased because of this - should I write a test for it?

@chiatt
Copy link
Member

chiatt commented Jan 25, 2025

I see coverage has decreased because of this - should I write a test for it?

That would be great. It should be an easy one since @whatisgalen has already blazed that trail. You could just copy his test_spatial_search_by_point_buffered test, add the following descriptor, and confirm that you get an error.

@override_settings(ANALYSIS_COORDINATE_SYSTEM_SRID ="Not an SRID")

@SDScandrettKint
Copy link
Member Author

@chiatt Test added fec5be1 :)

and conflicts resolved (7772749)

@chiatt
Copy link
Member

chiatt commented Jan 30, 2025

Sorry @SDScandrettKint - Could you move your changelog entry to the 7.6.7 release notes?

@chiatt chiatt merged commit 02ac0d4 into archesproject:dev/7.6.x Jan 31, 2025
6 of 7 checks passed
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.

2 participants