Skip to content

fix chargelog#1483

Merged
LKuemmel merged 3 commits intoopenWB:masterfrom
LKuemmel:fix_chargelog
Mar 25, 2024
Merged

fix chargelog#1483
LKuemmel merged 3 commits intoopenWB:masterfrom
LKuemmel:fix_chargelog

Conversation

@LKuemmel
Copy link
Copy Markdown
Contributor

No description provided.

@LKuemmel LKuemmel added this to the 2.1.4 milestone Mar 15, 2024
@LKuemmel LKuemmel changed the title upgrade existing timestamp in chargelog data fix chargelog Mar 15, 2024
@LKuemmel LKuemmel requested a review from benderl March 15, 2024 13:25
convert_file(file)
self.__update_topic("openWB/system/datastore_version", 38)

def upgrade_datastore_38(self) -> None:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sollte der Suffix nicht auch angepasst werden? Falls nicht, sollte man ihn dann nicht ganz abschaffen?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was meinst Du genau mit "Suffix"?

Comment thread packages/control/chargelog/chargelog.py Outdated
Comment on lines +118 to +123
def get_value_or_default(func):
try:
return func()
except Exception:
log.exception(f"Error getting value für chargelog: {func}. Setting to default.")
return "-"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def get_value_or_default(func):
try:
return func()
except Exception:
log.exception(f"Error getting value für chargelog: {func}. Setting to default.")
return "-"
def get_value_or_default(func, default_value = "-"):
try:
return func()
except Exception:
log.exception(f"Error getting value for chargelog: {func}. Setting to default.")
return default_value

Wenn man den Standardwert übergeben kann, wird die Methode wesentlich vielseitiger nutzbar.
In dem Zuge sollte überdacht werden, ob - ein sinnvoller Standardwert für eine Variable ist, die eigentlich eine Zahl ist. Für "undefiniert" oder "ungültig" würde ich eher None verwenden.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

umgesetzt

@LKuemmel LKuemmel merged commit 2a035c4 into openWB:master Mar 25, 2024
@LKuemmel LKuemmel deleted the fix_chargelog branch March 25, 2024 12:23
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.

3 participants