Need help with a function field defined using MetaData Menu

What I’m trying to do

Hi everyone I am trying to implement a feature with my daily note template. The concept is pretty simple. I want to track if I felt that I got one percent better at being a human, maintained my current progress, or declined one percent for that day. I have a number property called day_type defined in each note that has the value of 1.01 for improvement, 1.00 for maintain, and 0.99 for decline. I want to also add a property called cumulative improvement that multiplies all of the previous values up to and including the current day’s note. This seems like it should be easy to implement using the function field defined using the MetaData Menu plugin. However, the value does not appear to be updating.

Here is the code I am using in the function field:

dv.pages('"Periodic Notes/Daily"')
  .where(p => dv.date(p.file.day) <= dv.date(current.file.day))
  .where(p => p.file.frontmatter.day_type !== undefined)
  .map(p => p.file.frontmatter.day_type)
  .reduce((acc, val) => acc * val, 1);

Things I have tried

  • Searching the help forum
  • Reading the documentation for MetaData Menu
  • Reddit search
  • Lots of debugging / trial and error