Hi,
While grading some students work, I have three fields: 2 which contain numbers and one that contains a macro, which uses EvalThis to calculate the result of the final note. So, for example I have
field1: 5.0
field2: 4.4
final: <<finalGrade>>
and <<finalGrade>>
is defined like:
\define finalGrade <<EvalThis "{{!!field1}}*0.4 + {{!!field2}}*0.6">>
If I invoke the <<finalGrade>>
inside a tiddler containing the three fields is possible to get a preview of the note, but the numeric extension is arbitrary while I would like it to round it to 1 decimal using the fixed operator (getting 4.6
instead of 4.640000000000001
in the previous example).
As EvalThis produces wikitext, I imagine that there is simple filter I can use for that. But also in all my “intuitive approaches” I don’t get the expected answer. So some combination of text substitution plus macro calls maybe needed, but I the rationale behind such combination escapes to me despite of my re-reading of Grok TW’s Text substitution and trying to adapt that lesson to this context.
Could some one point me on how to pass the result of the <<finalGrade>>
macro contained in the final
field as a parameter to the fixed[1]
operator so it can produce the expected result in the current tiddler where such fields are contained?
Thanks,