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

Weather Widget: Fix Location Lookup #399

Merged

Conversation

nickthegroot
Copy link
Contributor

Description

I work in a city that shares a name with a larger one. As such, the weather widget's call to wttr.in was incorrectly giving the weather for the larger city instead of my own.

This PR fixes the issue by instead fetching the weather based on a user's coordinates.

(Possibly) Related: #328

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  1. Observe weather widget with incorrect temp
  2. Click on weather widget, observe incorrect city location
  3. Merge changes
  4. Observe weather widget with correct temp
  5. Click on weather widget, observe correct city location

Test Configuration:

  • OS version: 14.4.1 (23E224)
  • Yabai version: yabai-v7.1.0
  • Übersicht version: Version 1.6 (82)

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings

Changes to make to the documentation

N/A

@nickthegroot nickthegroot changed the title 🐛 Fetch weather location by coordinates instead of city Weather Widget: Fix Location Lookup May 9, 2024
@Jean-Tinland
Copy link
Owner

That's nice, I hadn't thought about handling it this way!

Thanks :)

@Jean-Tinland Jean-Tinland merged commit c3a63f9 into Jean-Tinland:master May 20, 2024
@Jean-Tinland
Copy link
Owner

I had to revert this change as it was not working with my coordinates for unknown reasons...

The code is now working this way:

const { city, zip } = position?.address || {};
location.current = zip || city;

The zip code should be enough to avoid city name collisions. Please let me know if this is working for you.

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.

None yet

2 participants