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

MMM-Fuel / Gasbuddy - Gas Prices Not Correctly Sorted #110

Closed
butchkemper opened this issue Jun 5, 2023 · 7 comments
Closed

MMM-Fuel / Gasbuddy - Gas Prices Not Correctly Sorted #110

butchkemper opened this issue Jun 5, 2023 · 7 comments
Labels

Comments

@butchkemper
Copy link

butchkemper commented Jun 5, 2023

Platform (Hardware/OS): Raspberry Pi Model 3 A+

Node version:

MagicMirror² version: v2.23.0

Module version: MMM-Fuel 2.4.0

Description of the issue:

Prices do not sort into correct descending order: entry 5 is more than entry 1, entry 6 is more than entry 2, and entry 7 is equal to entry 2. Please see attached graphic.

Config data is:
{
module: "MMM-Fuel",
position: "top_right",
config: {
provider: "gasbuddy",
zip: "75048",
types: ["regular"],
sortby: "regular",
max: 7,
showDistance: false,
fade: false,
updateinterval: 30000,
rotate: false,
rotateInterval: 15000
}
},

MMM-Fuel-Gasbuddy

@butchkemper
Copy link
Author

An update to this issue.

I observed sometimes the last fuel price entries which were not sorted correctly would display as >$2.99. The Gas Buddy and webpage application showed price for that station as "---" (without the quotes). I think that means "price not reported".

When the price is "---", the MMM-Fuel data gathering process inserts the price from the previous station and places a ">" before the price amount.

It appears there are two issues with the Gasbuddy routines: 1) items are not correctly sorted; 2) items with "price not provided" are incorrectly displayed.

@butchkemper
Copy link
Author

Update #2

I found the place where missing prices are handled apis/utils/index.js so everything is working as designed. Please excuse that ring.

Butch

@butchkemper
Copy link
Author

Updated original comment for updateinterval = 30000 instead of 30.

@fewieden
Copy link
Owner

fewieden commented Jul 9, 2023

@butchkemper first of all thank you for your donation, much appreciated. I have not received notifications for your issue and only saw it after looking into your Github profile.

Looking at your config I can spot two issues caused by the wrong letter casing. It should be camel-cased like this:

updateInterval: 30000,
sortBy: "regular",

image

There is a fallback mechanism if there is a wrong value, so it still used regular for the sorting.

The sorting is indeed broken. I created a fix on the develop branch. You can test it with the following commands until I release a new version on the master branch:

cd ~/MagicMirror/modules/MMM-Fuel
git checkout develop
git pull
npm i --production

@butchkemper
Copy link
Author

Thank you for the response. Here are the results from doing the commands you suggested:

pi@MagicMirror:/MagicMirror/modules/MMM-Fuel $ git checkout develop
M package-lock.json
Branch 'develop' set up to track remote branch 'develop' from 'origin'.
Switched to a new branch 'develop'
pi@MagicMirror:
/MagicMirror/modules/MMM-Fuel $ git pull
hint: Pulling without specifying how to reconcile divergent branches is
hint: discouraged. You can squelch this message by running one of the following
hint: commands sometime before your next pull:
hint:
hint: git config pull.rebase false # merge (the default strategy)
hint: git config pull.rebase true # rebase
hint: git config pull.ff only # fast-forward only
hint:
hint: You can replace "git config" with "git config --global" to set a default
hint: preference for all repositories. You can also pass --rebase, --no-rebase,
hint: or --ff-only on the command line to override the configured default per
hint: invocation.
From https://github.com/fewieden/MMM-Fuel
d416546..eb32037 develop -> origin/develop
Updating d416546..eb32037
error: Your local changes to the following files would be overwritten by merge:
package-lock.json
Please commit your changes or stash them before you merge.
Aborting

I am totally new to git so I need you help to know what to do.

Thanks.

Butch

@fewieden
Copy link
Owner

fewieden commented Jul 9, 2023

@butchkemper there are modifications on your machine for the file package-lock.json.

You can revert that file with git checkout package-lock.json.

@butchkemper
Copy link
Author

@fewieden Thank you for the help. MMM-Fuel with Gasbuddy is working and the sort problem is corrected.

This was referenced Mar 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants