This commit is contained in:
chaos 2024-11-09 15:58:44 +00:00
parent 61994bafb0
commit 0dfb7fab72

View file

@ -9,6 +9,16 @@ def formatExperienceTitle:
. as $experience | . as $experience |
"\"\(.title)\": \(.creationDate / 1000 | strftime("%d-%m-%Y"))"; "\"\(.title)\": \(.creationDate / 1000 | strftime("%d-%m-%Y"))";
def formatDose($dose; $unit; $isEstimate; $standardDeviation):
if $dose == null then
"Unknown"
else
(if $isEstimate then "~" else "" end) as $estimate |
(if $standardDeviation != null then "±\($standardDeviation)" else "" end) as $standardDeviation |
"\($estimate)\($dose | numberLib::round(2))\($standardDeviation) \($unit)"
end;
def formatIngestionDose($customUnits): def formatIngestionDose($customUnits):
. as $ingestion | . as $ingestion |
(. | journalLib::ingestionDose($customUnits)) as $dose | (. | journalLib::ingestionDose($customUnits)) as $dose |
@ -18,14 +28,13 @@ def formatIngestionDose($customUnits):
if $ingestion.dose == null then if $ingestion.dose == null then
"Unknown" "Unknown"
elif $customUnit == null then elif $customUnit == null then
if $ingestion.isDoseAnEstimate then "~" else "" end + formatDose($dose; $unit; $ingestion.isDoseAnEstimate; $standardDeviation)
"\($dose | numberLib::round(2))" +
if $standardDeviation != null then
"±\($standardDeviation)"
else "" end +
" \($unit)"
else else
"\($dose) \($unit) (\($customUnit.dose) \($unit) * \($ingestion.dose) \($customUnit.unit))" formatDose($dose; $unit; $ingestion.isDoseAnEstimate; $standardDeviation) +
" (" +
formatDose($customUnit.dose; $unit; $customUnit.isEstimate; $customUnit.estimatedDoseStandardDeviation) +
" * " +
formatDose($ingestion.dose; $customUnit.unit; $ingestion.isDoseAnEstimate; $ingestion.estimatedDoseStandardDeviation)
end; end;
def formatIngestionTime: def formatIngestionTime: