introduce weekdays to fixed_hours tariff#3252
introduce weekdays to fixed_hours tariff#3252tpd-opitz wants to merge 2 commits intoopenWB:masterfrom
Conversation
bd6cec9 to
0e4119e
Compare
0e4119e to
c481cb0
Compare
|
|
||
| # Process tariffs to ensure weekdays list is present | ||
| for tariff in self.tariffs: | ||
| if "active_times" in tariff and "weekdays" not in tariff["active_times"]: | ||
| tariff["active_times"]["weekdays"] = list(range(7)) # Default to all weekdays | ||
|
|
There was a problem hiding this comment.
| # Process tariffs to ensure weekdays list is present | |
| for tariff in self.tariffs: | |
| if "active_times" in tariff and "weekdays" not in tariff["active_times"]: | |
| tariff["active_times"]["weekdays"] = list(range(7)) # Default to all weekdays |
Bitte über die update_config abbilden, damit die Einstellungen immer konsistent sind. Du kannst Dich zB an upgrade_datastore_104 orientieren.
There was a problem hiding this comment.
Ich inkrementiere also DATASTORE_VERSION und lege ne neue Funktion an.
Muss noch irgendwo vermerkt werden, dass die neue datastore version aufgerufen werden muss?
There was a problem hiding this comment.
Nein, dafür ist DATASTORE_VERSION . Daran wird geprüft, ob noch eine upgrade datastore-Version aufgerufen werden muss.
There was a problem hiding this comment.
Bitte den obsoleten Code noch entfernen.
| # If no weekdays specified, assume all days are active | ||
| weekdays = tariff["active_times"]["weekdays"] or range(7) |
There was a problem hiding this comment.
| # If no weekdays specified, assume all days are active | |
| weekdays = tariff["active_times"]["weekdays"] or range(7) | |
| weekdays = tariff["active_times"]["weekdays"] |
Wird über update_config abgebildet.
There was a problem hiding this comment.
Bitte den obsoleten Code noch entfernen.
c481cb0 to
9bf5891
Compare
https://forum.openwb.de/viewtopic.php?t=11934
TODO: update UI
[ { "name": "tariff1", "price": 100, "active_times": { "dates": [("01-01", "31-12")], "times": [("08:00", "12:00")], "weekdays": [0, 1, 2, 3, 4], # active on weekdays }, }, { "name": "tariff1", "price": 200, "active_times": { "dates": [("01-01", "31-12")], "times": [("08:00", "12:00")], "weekdays": [5, 6], # active on weekends }, }, ]