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

**URL:** <https://forums.ankiweb.net/t/methodology-to-determine-the-best-amount-of-time-to-be-spent-on-a-card-on-average/46364>\
**Category:** Learning Effectively\
**Created:** [June 23, 2024, 8:22am UTC](https://forums.ankiweb.net/t/methodology-to-determine-the-best-amount-of-time-to-be-spent-on-a-card-on-average/46364 "2024-06-23T08:22:24Z")\
**Posts on this page:** 15\
**Page:** 2

<div class="post-metadata">

**Author:** ![DerIshmaelite](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/derishmaelite/32/17983_2.png) [@DerIshmaelite](https://forums.ankiweb.net/u/DerIshmaelite)\
**Post date:** [June 23, 2024, 8:11pm UTC](https://forums.ankiweb.net/t/methodology-to-determine-the-best-amount-of-time-to-be-spent-on-a-card-on-average/46364/21 "2024-06-23T20:11:02Z")

</div>

> {{#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 😅

> [@Methodology to determine the best amount of time to be spent on a card on average](https://forums.ankiweb.net/t/methodology-to-determine-the-best-amount-of-time-to-be-spent-on-a-card-on-average/46364/12):
>
> I had some time and interest to tinker on this so I made it show an indicator instead. It should now properly reset the timers when advancing to the next card too. This goes in the card Front again (edit the JS Api part to have your own email/github this time) \<script\> var frontTimer; var backTimer; function initAutoAdvance(options = {}) { const { goToAnswerSeconds = 5, answerSeconds = 5, // Threshold when to add extra time for ease easeThreshold = 2.5, …

* * *

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](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/3X/d/8/d80ffa7bab9fb4b619af1db8069670dd5ef61934.png)

![image](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/3X/4/0/4079135142f05035cc7a76591c385790f63dc8b8.png)  
 ![image](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/3X/6/7/6787c0060843f1c6eea38859dffefa429dbfca94.png)

* * *

---

<div class="post-metadata">

**Author:** ![jhhr](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/jhhr/32/21339_2.png) [@jhhr](https://forums.ankiweb.net/u/jhhr)\
**Post date:** [June 23, 2024, 8:26pm UTC](https://forums.ankiweb.net/t/methodology-to-determine-the-best-amount-of-time-to-be-spent-on-a-card-on-average/46364/22 "2024-06-23T20:26:47Z")

</div>

> 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:

```auto
function onTimerEnd() {
  ...

  document.body.appendChild(indicator);
}

```

With this:

```auto
function onTimerEnd() {
    ...

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

```

---

<div class="post-metadata">

**Author:** ![DerIshmaelite](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/derishmaelite/32/17983_2.png) [@DerIshmaelite](https://forums.ankiweb.net/u/DerIshmaelite)\
**Post date:** [June 23, 2024, 8:30pm UTC](https://forums.ankiweb.net/t/methodology-to-determine-the-best-amount-of-time-to-be-spent-on-a-card-on-average/46364/23 "2024-06-23T20:30:21Z")

</div>

> [@jhhr](#):
>
> ```auto
> initIndicatorTimer({
> // Customize options as you please
> // Use avg time from info-TimeAvg field from addon, if available
> // otherwise use static base wait time of 5 seconds
> waitSeconds: {{#info-TimeAvg:}}parseFloat({{info-TimeAvg:}}){{\info-TimeAvg:}}{{^info-TimeAvg:}}5{{\info-TimeAvg:}},
> easeThreshold: 2,
> easeStep: 0.7,
> });
> 
> ```

Hmm Anki doesn’t seem to want to recognize the average field  
 ![image](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/3X/d/e/de6bc09a3e6172a29f3e1601557eb140fa1f7858.png)

Am I missing something. I have installed the addon

---

<div class="post-metadata">

**Author:** ![jhhr](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/jhhr/32/21339_2.png) [@jhhr](https://forums.ankiweb.net/u/jhhr)\
**Post date:** [June 23, 2024, 8:31pm UTC](https://forums.ankiweb.net/t/methodology-to-determine-the-best-amount-of-time-to-be-spent-on-a-card-on-average/46364/24 "2024-06-23T20:31:49Z")

</div>

> [@DerIshmaelite](#):
>
> 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 😅

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.

---

<div class="post-metadata">

**Author:** ![jhhr](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/jhhr/32/21339_2.png) [@jhhr](https://forums.ankiweb.net/u/jhhr)\
**Post date:** [June 23, 2024, 8:33pm UTC](https://forums.ankiweb.net/t/methodology-to-determine-the-best-amount-of-time-to-be-spent-on-a-card-on-average/46364/25 "2024-06-23T20:33:24Z")

</div>

> [@DerIshmaelite](#):
>
> Hmm Anki doesn’t seem to want to recognize the average field  
> ![image](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/3X/d/e/de6bc09a3e6172a29f3e1601557eb140fa1f7858.png)
> 
> Am I missing something. I have installed the addon

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

---

<div class="post-metadata">

**Author:** ![DerIshmaelite](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/derishmaelite/32/17983_2.png) [@DerIshmaelite](https://forums.ankiweb.net/u/DerIshmaelite)\
**Post date:** [June 23, 2024, 8:34pm UTC](https://forums.ankiweb.net/t/methodology-to-determine-the-best-amount-of-time-to-be-spent-on-a-card-on-average/46364/26 "2024-06-23T20:34:41Z")

</div>

![image](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/3X/2/4/244421dcb90c56bcc78120ea476efe14cd217140.png)

Now it shows me this

* * *

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

shows this  
 ![image](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/3X/0/8/081515e30357b37cba99cd4b059ae0bc7cee1179.png)

---

<div class="post-metadata">

**Author:** ![jhhr](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/jhhr/32/21339_2.png) [@jhhr](https://forums.ankiweb.net/u/jhhr)\
**Post date:** [June 23, 2024, 8:59pm UTC](https://forums.ankiweb.net/t/methodology-to-determine-the-best-amount-of-time-to-be-spent-on-a-card-on-average/46364/27 "2024-06-23T20:59:23Z")

</div>

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:

```auto
  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,
    });

```

---

<div class="post-metadata">

**Author:** ![DerIshmaelite](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/derishmaelite/32/17983_2.png) [@DerIshmaelite](https://forums.ankiweb.net/u/DerIshmaelite)\
**Post date:** [June 23, 2024, 9:03pm UTC](https://forums.ankiweb.net/t/methodology-to-determine-the-best-amount-of-time-to-be-spent-on-a-card-on-average/46364/28 "2024-06-23T21:03:41Z")

</div>

This works, but now no indicator is shown anymore ☹

---

<div class="post-metadata">

**Author:** ![jhhr](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/jhhr/32/21339_2.png) [@jhhr](https://forums.ankiweb.net/u/jhhr)\
**Post date:** [June 23, 2024, 9:08pm UTC](https://forums.ankiweb.net/t/methodology-to-determine-the-best-amount-of-time-to-be-spent-on-a-card-on-average/46364/29 "2024-06-23T21:08:45Z")

</div>

Might be that

- some error is crashing the code so it doesn’t run (check the Console tab with [this addon](https://ankiweb.net/shared/info/31746032))
- 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)

---

<div class="post-metadata">

**Author:** ![DerIshmaelite](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/derishmaelite/32/17983_2.png) [@DerIshmaelite](https://forums.ankiweb.net/u/DerIshmaelite)\
**Post date:** [June 23, 2024, 9:25pm UTC](https://forums.ankiweb.net/t/methodology-to-determine-the-best-amount-of-time-to-be-spent-on-a-card-on-average/46364/30 "2024-06-23T21:25:08Z")

</div>

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](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/3X/9/9/9970661ff56b31c4ebb0775e9c57eafbe34b0b76.png)  
 ![image](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/3X/c/e/cef8b5e7419076b3148f73b2b21210ed5ea7dba9.png)  
 ![image](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/3X/f/c/fc36671229d4bb1979b7dcd2be6ba4ff12d4227b.png)  
 ![image](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/3X/9/9/991d5384c5e2ca2b524963559c1bd992eee131be.png)

* * *

Says undefined.

 ![image](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/3X/7/d/7d5753d80232ed911b7e9d3f0da4dda8e671a8a7.png)

> I think I’ll quit for today.

Oke 😞 . 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

---

<div class="post-metadata">

**Author:** ![DerIshmaelite](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/derishmaelite/32/17983_2.png) [@DerIshmaelite](https://forums.ankiweb.net/u/DerIshmaelite)\
**Post date:** [June 23, 2024, 9:36pm UTC](https://forums.ankiweb.net/t/methodology-to-determine-the-best-amount-of-time-to-be-spent-on-a-card-on-average/46364/31 "2024-06-23T21:36:37Z")

</div>

WAIT! I think I know where the issue lies.

I have deleted /script tag at the end 💀

I am way too stupid at codes

---

<div class="post-metadata">

**Author:** ![DerIshmaelite](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/derishmaelite/32/17983_2.png) [@DerIshmaelite](https://forums.ankiweb.net/u/DerIshmaelite)\
**Post date:** [June 24, 2024, 6:33pm UTC](https://forums.ankiweb.net/t/methodology-to-determine-the-best-amount-of-time-to-be-spent-on-a-card-on-average/46364/32 "2024-06-24T18:33:21Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jhhr](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/jhhr/32/21339_2.png) [@jhhr](https://forums.ankiweb.net/u/jhhr)\
**Post date:** [June 25, 2024, 2:43pm UTC](https://forums.ankiweb.net/t/methodology-to-determine-the-best-amount-of-time-to-be-spent-on-a-card-on-average/46364/33 "2024-06-25T14:43:41Z")

</div>

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](https://forums.ankiweb.net/t/additional-card-fields-official-thread/541/43)

---

<div class="post-metadata">

**Author:** ![DerIshmaelite](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/derishmaelite/32/17983_2.png) [@DerIshmaelite](https://forums.ankiweb.net/u/DerIshmaelite)\
**Post date:** [June 25, 2024, 4:21pm UTC](https://forums.ankiweb.net/t/methodology-to-determine-the-best-amount-of-time-to-be-spent-on-a-card-on-average/46364/34 "2024-06-25T16:21:41Z")

</div>

👍

> [@Additional Card Fields \[Official thread\]](https://forums.ankiweb.net/t/additional-card-fields-official-thread/541/44):
>
> Hello. I was wondering if there is a field that represents the average review time for x number of reviews of a single card and not ALL reviews for a single card.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/1X/8f1279ababc5879d54e4838989f606cfe55af8c7.jpeg) [@system](https://forums.ankiweb.net/u/system)\
**Post date:** [September 23, 2024, 4:22pm UTC](https://forums.ankiweb.net/t/methodology-to-determine-the-best-amount-of-time-to-be-spent-on-a-card-on-average/46364/35 "2024-09-23T16:22:37Z")

</div>

Closed on September 23, 2024, 4:22pm UTC

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

[Previous page](https://forums.ankiweb.net/t/methodology-to-determine-the-best-amount-of-time-to-be-spent-on-a-card-on-average/46364.md?page=1)
