Perf: prevent duplicate database read when home deck

This commit is contained in:
Luc Mcgrady 2025-11-02 23:59:48 +00:00
parent 0e3089d7a8
commit 3b043c7e85
No known key found for this signature in database
GPG key ID: 4F3D7A0B17CC3D9C

View file

@ -443,10 +443,14 @@ impl Collection {
.storage .storage
.get_deck(card.deck_id)? .get_deck(card.deck_id)?
.or_not_found(card.deck_id)?; .or_not_found(card.deck_id)?;
let home_deck = self let home_deck = if card.original_deck_id.0 == 0 {
.storage &deck
.get_deck(card.original_or_current_deck_id())? } else {
.or_not_found(card.original_or_current_deck_id())?; &self
.storage
.get_deck(card.original_deck_id)?
.or_not_found(card.original_deck_id)?
};
let config = self let config = self
.storage .storage
.get_deck_config(home_deck.config_id().or_invalid("home deck is filtered")?)? .get_deck_config(home_deck.config_id().or_invalid("home deck is filtered")?)?