SwEnt-Group13 / Unio

The world’s largest campus life platform.
3 stars 1 forks source link

Feat/geocoder location nominatim #224

Closed Zafouche closed 4 days ago

Zafouche commented 5 days ago

Description

This PR implements the integration of the Nominatim API into the Event creation screen. It allows users to search for and select a location. Location suggestions are fetched when the user types into the location input text field (with a 1 second debounce delay, to ensure no more than 1 request per second are made), and users can select a place from a dropdown list, which fills the location field with the place’s name and address, and allows us to get the exact coordinates of the address.

Motivation and Context

By integrating the Nominatim API, we enable users to search and select a location easily. This approach provides greater flexibility, as I have done my best to abstract this as much as possible, to be able to easily switch to another tool, like Search Places API, or Photon API.

NominatimLocationSearchViewModel:

NominatimLocationRepository:

EventCreationScreen:

What's next

Zafouche commented 4 days ago

I will open this PR for review when the CI passes, such that my teammates can review my work: the feature works well, I just need to write more tests.

I am still working on improving the test coverage by:

Other than that, the test coverage looks pretty good even if the e2e isn't added so I'm happy with it.

Zafouche commented 4 days ago

Good job implementing this! This nicely completes the event creation. Don't forget to comment your code, but besides that no complaints, LGTM (as long as you add your tests).

Thanks a lot for reminding me to add documentation! I've been deep in testing that I forgot about it, very good point. Just added documentation.

We should also be careful about merging our PRs as I refactored the EventCreation page a bit

And you're right, we should

Zafouche commented 4 days ago

Final verdict:

However I will push the code of both the start of the e2e test and the attempt using the solution described above in the branch test/geocoder-e2e-and-viewmodel, that I will pick up or delete and start from scratch after #223 has been merged to main.

sonarcloud[bot] commented 4 days ago

Quality Gate Passed Quality Gate passed

Issues
3 New issues
0 Accepted issues

Measures
0 Security Hotspots
72.8% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarQube Cloud