Here is a bit of code about getting the right pairing for the current round:
<$let currPairing = {{{
[<pairings>split[ ]nth[$roundid$]!is[blank]else[sequential]]
:map[[$roundid$]match[1]then[rank]else<currentTiddler>]
:map[[$roundid$]!match[1]then<currentTiddler>match[rank]then[sequential]else<currentTiddler>]
}}}
>
pairings
is a space%separated list of paisring, the $roundid$
-th being the one fetched.
However:
- with the firt
:mbp
, the pairing method is silently forced at “rank” for the first round; - with the second
:map
, any “rank” pairing method is silently replaced by “sequential” in any other round.
It would be nice to be able to have a side effect such as to notice if any correction happens.
I have created a dump
filter that does this by logging in the javascript console. But this is not very useful for the end user. If it would be possible to log it somewehere (tiddler, system temp file, tw variable, whatever, this would be a real bonus.
Of course I k’now that filters are not meant to have side effects. Yet since they are at the core of our algorithms, it would be helpful. Look at my simple example, how I would need boiler plate just to achieve this.Something lihke this:
<$let userPairing = {{{ [<pairings>split[ ]nth[$roundid$]!is[blank]else[sequential]] }}}
firstCorr = {{{ [[$roundid$]match[1]then<userPairing>!match[rank]then[rank]] }}}
laterCorr ={{{ [[$roundid$]!match[1]then<currentTiddler>match[rank]then[sequential]] }}}
currPairing = {{{ [<userPairing>] [<firstCorr>] [<laterCorr>] +[!is[blank]last[]] }}}
>
<$action-setfield $tiddler=log userPairing=<<userPairing>>_firstCorr=<<firstCorr>> laterCorr=<<laterCorr>>/>
Or do you think the later piece of code is really the way things should be done if I want to do the things AND know what have been done?