nanreh / calendar-hack

Calendar Hack: a web application for runners who train for races.
https://www.defy.org/hacks/calendarhack
MIT License
71 stars 24 forks source link

Calendar Event Description New Line #109

Closed tinkeringtuck closed 3 weeks ago

tinkeringtuck commented 1 month ago

I generated a calendar from the Pfitz half plan (edit: by Pfitz half plan I mean FFR half plan), and on my mobile calendar I see something like "Endurance" whereas on the browser I would see "Endurance 11mi". I'm suspecting that there is a new line character between Endurance and 11mi. When I click edit on calendar event on mobile, I can see the remaining event title and "Endurance" and "11mi" are on different lines. On the browser, when I click edit, the new line appears removed/not displayed and it shows "Endurance11mi" (w/ no space or new line).

I'm using google calendar FWIW.

I'm happy to open a PR but I'm not confident I know what the issue is, I also don't know if having the new line is desirable for other reasons I'm overlooking. I did find the .json plans for Pfitz and I see that a \n is added between the first description and the distance. I would propose that the \n between the overall distance for the day, and the overall description should be removed. For days that have additional text than just overall description, the "\n"s after the overall description and overall distance could be left as is, however it's still undesirable for mobile use because to read the additional text I have to a) know that there is additional text that's supposed to be there and then b) click edit on the calendar event to read it. Here is two examples of what I am thinking:

"Endurance\n{8}" would change to "Endurance {8}" "Lactate threshold\n{7}\n14 min LT interval (jog 4 min recovery)\n12 min LT interval" would change to "Lactate threshold {7}\n14 min LT interval (jog 4 min recovery)\n12 min LT interval"

Assuming this is a good idea/issue, is there a better implementation than updating all the jsons? Not sure about the other plans if they follow a similar format to Pfitz and if this applies to them or not.

Alternatively, I'm not sure that .ical supports notes/additional description (other than title description) but I was considering if this could be utilized for the more detailed description (everything but overall description and overall miles).

nanreh commented 4 weeks ago

Thanks for the report!

It definitely seems that newlines in iCal titles don't render well in Google Calendar. I've removed them from the plans (the YAML files).

Also decided it may be wise to always render an iCal description: if the plan doesn't explicitly provide one, the title will be passed in so it's there as a fallback in case the title is extra long or is difficult to read for other reasons.

Hopefully this makes things work for you and other folks on all the various calendar apps they're using. Going to leave the issue open for a bit so I can test more. If you get a chance, let me know if things look better on your end.

a88c6305b47fcc9016db3385884805934613ff52