I’ve recently updated to the edge version and surprisingly this thing stopped working.
I had this function that returns a list of tasks from specific namespace (hence namePrefix):
function tasks.list()
return query [[
from index.tag "task"
where name.startsWith(namePrefix)
]]
end
And then I have this one, that uses that function to further narrow down the tasks I want to see on some page:
${query[[
from tasks.list()
select "[[" .. name .. "]]"
where status == "completed"
and journal.withinThisWeek(utils.getLastPageNamePart(), doneDate)
order by doneDate
]] or "You've done nothing!"}
I’m not sure which version I had before, so this could’ve been changed even months back.
Thing is - I found this kind of composability quite useful. My question is - should this work or does it have some obvious flaw that I can’t see right now? Is there any alternative approach to have this working?
Stopped working means you’re getting an error, or no results?
This should still work, beside the bug in name.startsWith(namePrefix), which should be name:startsWith(namePrefix) but that should never have worked?
Note that recently we made the Lua interpreter more strict (closer to the the spec) and this is highlighting some latent bugs in people’s code. Most commonly, previously the + could be used to concatenate strings (which is not Lua semantics), whereas now it no longer can (you need to use ..). Perhaps something like that is happening elsewhere in your code?