More specifically, under the conditions of a tag associated with a "task," properties for an "alarm set" to wakeup and "unwinding" time before bed is altered. To do this I use relational and rollup properties.
Let's Begin With Tasks
In the task database there is only three properties (Name, Priority and Deadline). We want to connect 'Name' and 'Priority' into a separate sleep tracker.
The Sleep Tracker
In order to connect tasks, we need to first create a relation property and connect that property to the 'Tasks' database.
Next, configure a rollup property like so:
Original Formulas
Looking at the formulas of the "Sleep Tracker," there are three distinct properties:
Unwinding โ Time to unwind before bed (1 hour before "Latest Sleep Time") โ
dateSubtract(prop("L.Sleep Time"), 1, "hours")
L. Sleep Time โ Latest time to go to sleep dependent upon "Alarm Set" (7 hours before alarm) โ
dateSubtract(prop("Alarm Set"), 7, "hours")
Alarm Set โ Time to wake up the next morning (6:00 AM) โ
dateAdd(prop("Date"), 30, "hours")
New Formulas With Inclusion Of Tasks Database
Using the new properties, here are modified formulas that give the original formulas more nuance.
Unwinding โ
if(contains(prop("Priority"), "Essay"), concat("โญ๏ธ Look Over Essay" + " -- " + format(dateSubtract(prop("L.Sleep Time"), 1, "hours"))), if(contains(prop("Priority"), "Exam"), concat("โญ๏ธ Meditate" + " --" + format(dateSubtract(prop("L.Sleep Time"), 1.5, "hours"))), if(day(prop("Date")) == 5, "๐ Flexible", format(dateSubtract(prop("L.Sleep Time"), 1, "hours")))))
L. Sleep Time โ
dateSubtract(prop("Alarm Set"), 7, "hours")
Alarm Set โ
(day(prop("Date")) == 5) ? dateAdd(prop("Date"), 32.5, "hours") : dateAdd(prop("Date"), 30, "hours")