Deck status (Idea/Building/Built/Retired) and pulled-card tracking
Only building and built decks now claim owned copies, so several idea decks can share one copy without an over-assignment warning. Deck cards track how many copies are physically pulled: physical decks list cards to pull with their source (a storage box, or another deck to take a copy from), and idea decks split cards into available / in other decks / not owned. The deck list shows status chips with to-pull counts, filters by status, and collapses retired decks. Status and pulled counts sync, which bumps the library document to version 4. Existing decks migrate as ideas. Closes #25 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -7,7 +7,7 @@ use std::path::PathBuf;
|
||||
use std::sync::Mutex;
|
||||
|
||||
use mtgc_core::{
|
||||
CardRef, CardSuggestion, Deck, DeckEntry, LibraryCard, LibraryCopy, LibraryFacets,
|
||||
CardRef, CardSuggestion, Deck, DeckEntry, DeckStatus, LibraryCard, LibraryCopy, LibraryFacets,
|
||||
LibraryFilter, LibraryStats, PrintingRef, SuggestOptions,
|
||||
};
|
||||
use serde::Serialize;
|
||||
@@ -329,6 +329,30 @@ pub fn set_deck_format(db: Db, deck_id: i64, format: String) -> Res<()> {
|
||||
.map_err(|e| e.to_string())
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub fn set_deck_status(db: Db, deck_id: i64, status: DeckStatus, assembled: bool) -> Res<()> {
|
||||
let s = db.lock().unwrap();
|
||||
s.catalog()?
|
||||
.set_deck_status(deck_id, status, assembled)
|
||||
.map_err(|e| e.to_string())
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub fn set_deck_card_pulled(db: Db, deck_id: i64, oracle_id: String, pulled: i64) -> Res<i64> {
|
||||
let s = db.lock().unwrap();
|
||||
s.catalog()?
|
||||
.set_deck_card_pulled(deck_id, &oracle_id, pulled)
|
||||
.map_err(|e| e.to_string())
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub fn take_deck_card_copy(db: Db, from_deck_id: i64, to_deck_id: i64, oracle_id: String) -> Res<bool> {
|
||||
let s = db.lock().unwrap();
|
||||
s.catalog()?
|
||||
.take_deck_card_copy(from_deck_id, to_deck_id, &oracle_id)
|
||||
.map_err(|e| e.to_string())
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub fn set_deck_cover(db: Db, deck_id: i64, oracle_id: Option<String>) -> Res<()> {
|
||||
let s = db.lock().unwrap();
|
||||
|
||||
@@ -108,6 +108,9 @@ pub fn run() {
|
||||
commands::duplicate_deck,
|
||||
commands::set_deck_format,
|
||||
commands::set_deck_cover,
|
||||
commands::set_deck_status,
|
||||
commands::set_deck_card_pulled,
|
||||
commands::take_deck_card_copy,
|
||||
commands::set_deck_commander,
|
||||
commands::set_deck_commanders,
|
||||
commands::search_partners,
|
||||
|
||||
Reference in New Issue
Block a user