Because it has to send ‘something’ back
You can add x in the else statement but (mentioning xth time) your if/then is inefficient
Alright.
I heard you. I just didn’t agree because I didn’t want all addresses to be lower case, only the ones that were in upper case.
Inefficient is that you test (!) all situations with their uppercase value (i.e. it has to convert to uppercase too to compare) and then you convert to lowercase, so for all records (say:100 rec.) it runs a case-test (so: 100x) and for a few it stores the converted ones (say: 30x)…i.e 130 conversions
By setting all to lowercase, you would only convert 100x and although 70x without added value…it is still less conversions
EDIT: and yes…for your 4-5 stations this is not an issue, it is more the concept of things
You’re focusing on the fact I am an inefficient idiot instead of reading what I write. I did not want all addresses to be converted to lower case.
I was trying to have as many stations as possible with their proper case (i.e. names Capitalized but not the rest, for instance “2 rue Georges Besse”) and convert only the ones that were all in uppercase because I cannot stand that.
With your code, I would end up with “2 rue georges besse”, which I do not want. It would be more efficient but it’s not the result I wanted.
I indeed did not see/understand that. Then the code would become mouch more complex too. As I donot have that situation with my stations (no part-correct addresses) this was not easy to see (some excuse although a bit weak)
No problem.
But if you see missing stations or stations with incorrect information, don’t hesitate to edit /homeassistant/custom_components/prix_carburant/stations_name.json
and do a pull request, the owner of the repo is very quick to merge the changes.
I know… I supported part of the code with him till about 2y ago (before the json came in the picture)