Methodology to determine the best amount of time to be spent on a card on average

{{#info-TimeAvg:}}parseFloat({{info-TimeAvg:}}){{\info-TimeAvg:}}{{^info-TimeAvg:}}5{{\info-TimeAvg:}},
easeThreshold: 2,

Now where do I put it in the code with the advancing code (not the non-advancing) just in case I want to try out both :sweat_smile:


also upon inspection, the blob does not go away with a new card. It just simply gets darker and darker with every new card

image

image
image


also upon inspection, the blob does not go away with a new card. It just simply gets darker and darker with every new card

Gah, I know why that’s happening.

Switch the last part in the onTimerEnd function where it adds the indicator:

function onTimerEnd() {
  ...

  document.body.appendChild(indicator);
}

With this:

function onTimerEnd() {
    ...

    // Insert indicator into the card content which gets reset on each review
    const qa = document.getElementById("qa");
    qa.appendChild(indicator);
}

Hmm Anki doesn’t seem to want to recognize the average field
image

Am I missing something. I have installed the addon

I just renamed the option in the newest version. In the others it
was the goToAnswerSeconds option that set how long to wait on the card front before advancing to the back.

1 Like

Oh, oops. I put the wrong slashes in. The correct slash is / not \

image

Now it shows me this


waitSeconds: {{#info-TimeAvg:}}parseFloat({{/info-TimeAvg:}}){{/info-TimeAvg:}}{{^info-TimeAvg:}}5{{/info-TimeAvg:}},

shows this
image

Hmm, I guess you’re not allowed to use the # and ^ conditional field syntax with custom filters? Well, that simplies things a bit since that can be removed. The downside is that the timer won’t work properly at all if you review on mobile or AnkiWeb.

Also, I didn’t actually test the addon’s info-TimeAvg field myself yet… Turns out that it produces a string like 24 seconds. That needs to parsed into a number which was unexpectedly tricky due to the string’s first character being charcode 8296 for some reason?

Anyway, this seems to be the working way to get the actual number value from the field:

  var rawTimeStr = "{{info-TimeAvg:}}";
  // Get digits only from string as it is in the format "24 seconds" with potentially weird invisible characters in the front
  rawTimeStr = rawTimeStr.replace(/\D/g, '');
  var avgTimeSeconds = parseInt(rawTimeStr);

    initIndicatorTimer({
      // Customize options as you please
      waitSeconds: avgTimeSeconds,
      easeThreshold: 2,
      easeStep: 0.7,
    });
1 Like

This works, but now no indicator is shown anymore :frowning:

Might be that

  • some error is crashing the code so it doesn’t run (check the Console tab with this addon)
  • the avg time is actually really long?

I think I’ll quit for today. You could investigate the code with some console.log() calls added to see if it’s actually running (checking the Console tab to see what gets printed)

I opened the console. I dont know how this works. i just checked and saw some error signs and there I see this. I don’t know how to fix this.

image
image
image
image


Says undefined.

I think I’ll quit for today.

Oke :disappointed: . I am sorry for gobbling up your time today. I just really wish if you help me see this through. I thank you very, very much for all the help you have given so far. I really mean it

WAIT! I think I know where the issue lies.

I have deleted /script tag at the end :skull:

I am way too stupid at codes

Is there a way to get this to take the average of only certain last x reviews (e.g. last 10)

Should be possible by modifying the code for the Additional Fields addon. I checked the code a bit but I couldn’t immediately see how to do it. You could ask the maintainer for help on this: Additional Card Fields [Official thread] - #43 by JaviSt97

1 Like

:+1:

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.