strautomator / core

Strautomator Core
MIT License
41 stars 5 forks source link

perceivedExertion not being expanded in template #41

Closed obriencj closed 10 months ago

obriencj commented 10 months ago

I have a calendar template like this:

${distance} @ ${speedAvg} (${perceivedExertion})
${elevationGain} (${climbingRatio})
${hrAvg}, ${wattsAvg}
Ride: ${gear}

But the resulting entries in ical look like this:

42.2mi @ 13mph (${perceivedExertion})
981ft (0.23)
145bpm, 149watts
Ride: Rove
obriencj commented 10 months ago

I think the issue is simply that the value was left unset for my last two rides, and the template chooses to leave the value unexpanded rather than using nil or unset as the interpolated text.

igoramadas commented 10 months ago

By default, the replace function will keep the original string if the target object has no matching field. I have added a small routine now to replace nulls with empty strings: https://github.com/strautomator/core/commit/bd32b508f3575a1d24cf26daad01e71634ece904

Will be released with the next deployment sometime this week.