Remove mapped fields
This commit is contained in:
parent
3f0ab40982
commit
6b606475df
|
@ -32,10 +32,12 @@ def import_data(obsidian_path: Path, dry_run=True):
|
|||
|
||||
for input_key, (output_key, unit) in mapping.items():
|
||||
v = row.get(input_key)
|
||||
if v is not None:
|
||||
if unit:
|
||||
v = str(v) + ' ' + unit
|
||||
if v:
|
||||
was_updated |= vault.add_statistic(date, output_key, v)
|
||||
if input_key != output_key:
|
||||
was_updated |= vault.add_statistic(date, input_key, None)
|
||||
del input_key, output_key, unit, v
|
||||
|
||||
if was_updated:
|
||||
|
|
|
@ -59,6 +59,8 @@ class ObsidianVault:
|
|||
return False
|
||||
|
||||
data.metadata[statistic_key] = amount
|
||||
if amount is None:
|
||||
del data.metadata[statistic_key]
|
||||
|
||||
with open(self._date_file_path(date), 'wb') as f:
|
||||
frontmatter.dump(data, f)
|
||||
|
|
Loading…
Reference in New Issue
Block a user