Show card NextDue to the flashcard management UI (#9621)

* Show RiffCard NextDue to the UI

* Show RiffCard NextDue to the UI

* Show card NextDue to the flashcard management UI
This commit is contained in:
debbbbie 2023-11-10 20:21:56 +08:00 committed by GitHub
parent 432634beea
commit 48c354e7de
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 30 additions and 5 deletions

View file

@ -175,6 +175,7 @@
"searchTip5": "to dismiss",
"showRecentUpdatedBlocks": "The most recently updated blocks will be shown when the input is empty",
"revisionCount": "Number of revisions",
"nextDue": "Next Due",
"flashcardNewCardLimit": "New Card Limit",
"flashcardNewCardLimitTip": "If there are many new cards, you can set the number of new cards to review through this item",
"flashcardReviewCardLimit": "Review Card Limit",

View file

@ -175,6 +175,7 @@
"searchTip5": "para descartar",
"showRecentUpdatedBlocks": "Los bloques actualizados más recientemente se mostrarán cuando la entrada esté vacía",
"revisionCount": "Número de revisiones",
"nextDue": "Revisa la próxima vez",
"flashcardNewCardLimit": "Límite de tarjeta nueva",
"flashcardNewCardLimitTip": "Si hay muchas tarjetas nuevas, puede establecer la cantidad de tarjetas nuevas para revisar a través de este elemento",
"flashcardReviewCardLimit": "Revisar límite de tarjeta",

View file

@ -175,6 +175,7 @@
"searchTip5": "pour ignorer",
"showRecentUpdatedBlocks": "Les blocs les plus récemment mis à jour seront affichés lorsque l'entrée est vide",
"revisionCount": "Nombre de révisions",
"nextDue": "Revoir la prochaine fois",
"flashcardNewCardLimit": "Nouvelle limite de carte",
"flashcardNewCardLimitTip": "S'il y a beaucoup de nouvelles cartes, vous pouvez définir le nombre de nouvelles cartes à examiner via cet élément",
"flashcardReviewCardLimit": "Revoir la limite de la carte",

View file

@ -175,6 +175,7 @@
"searchTip5": "退出搜索",
"showRecentUpdatedBlocks": "輸入為空時將顯示最近更新的塊",
"revisionCount": "複習次數",
"nextDue": "下次複習",
"flashcardNewCardLimit": "新卡上限",
"flashcardNewCardLimitTip": "如果新卡較多,可以通過該項設置新卡複習的數量",
"flashcardReviewCardLimit": "復習卡上限",

View file

@ -175,6 +175,7 @@
"searchTip5": "退出搜索",
"showRecentUpdatedBlocks": "输入为空时将显示最近更新的块",
"revisionCount": "复习次数",
"nextDue": "下次复习",
"flashcardNewCardLimit": "新卡上限",
"flashcardNewCardLimitTip": "如果新卡较多,可以通过该项设置新卡复习的数量",
"flashcardReviewCardLimit": "复习卡上限",

View file

@ -1,3 +1,4 @@
import * as dayjs from "dayjs";
import {Protyle} from "../protyle";
import {fetchPost} from "../util/fetch";
import {Dialog} from "../dialog";
@ -217,7 +218,8 @@ ${unicode2Emoji(item.ial.icon, "b3-list-item__graphic", true)}
<svg><use xlink:href="#iconTrashcan"></use></svg>
</span>
<span class="${(isMobile() || !hPath) ? "fn__none " : ""}b3-list-item__meta b3-list-item__meta--ellipsis" title="${escapeAttr(hPath)}">${escapeHtml(hPath)}</span>
<span aria-label="${window.siyuan.languages.revisionCount}" class="b3-tooltips b3-tooltips__w counter${item.riffCardReps === 0 ? " fn__none" : ""}">${item.riffCardReps}</span>
<span aria-label="${window.siyuan.languages.nextDue}" class="b3-tooltips b3-tooltips__w counter${!item.riffCard?.due ? " fn__none" : ""}">${dayjs(item.riffCard?.due).format("YYYY-MM-DD")}</span>
<span aria-label="${window.siyuan.languages.revisionCount}" class="b3-tooltips b3-tooltips__w counter${item.riffCard?.reps === 0 ? " fn__none" : ""}">${item.riffCard?.reps}</span>
</div>`;
isFirst = false;
} else {

View file

@ -903,7 +903,7 @@ interface IBlockTree {
}
interface IBlock {
riffCardReps?: number // 闪卡复习次数
riffCard?: IRiffCard,
depth?: number,
box?: string;
path?: string;
@ -925,6 +925,11 @@ interface IBlock {
ial: IObject
}
interface IRiffCard {
due?: string;
reps?: number; // 闪卡复习次数
}
interface IModels {
editor: import("../editor").Editor [],
graph: import("../layout/dock/Graph").Graph[],

View file

@ -24,6 +24,7 @@ import (
"github.com/88250/lute/ast"
"github.com/88250/lute/parse"
"github.com/open-spaced-repetition/go-fsrs"
"github.com/siyuan-note/siyuan/kernel/sql"
"github.com/siyuan-note/siyuan/kernel/treenode"
"github.com/siyuan-note/siyuan/kernel/util"
@ -60,8 +61,20 @@ type Block struct {
Created string `json:"created"`
Updated string `json:"updated"`
RiffCardID string `json:"riffCardID"`
RiffCardReps uint64 `json:"riffCardReps"`
RiffCardID string `json:"riffCardID"`
RiffCard *RiffCard `json:"riffCard"`
}
type RiffCard struct {
Due time.Time `json:"due"`
Reps uint64 `json:"reps"`
}
func GetRiffCard(card *fsrs.Card) *RiffCard {
return &RiffCard{
Due: card.Due,
Reps: card.Reps,
}
}
func (block *Block) IsContainerBlock() bool {

View file

@ -260,7 +260,7 @@ func getCardsBlocks(cards []riff.Card, page int) (blocks []*Block, total, pageCo
}
b.RiffCardID = cards[i].ID()
b.RiffCardReps = cards[i].(*riff.FSRSCard).C.Reps
b.RiffCard = GetRiffCard(cards[i].(*riff.FSRSCard).C)
}
return
}