2024-06-12 22:37:13 +00:00
|
|
|
package cli
|
|
|
|
|
|
|
|
import (
|
|
|
|
"database/sql"
|
|
|
|
"fmt"
|
|
|
|
"sevenkeys/logic"
|
|
|
|
)
|
|
|
|
|
2024-09-07 18:07:48 +00:00
|
|
|
var shouldRefreshSearch bool = true
|
|
|
|
|
|
|
|
func getSearchCriteria() logic.SearchCriteria {
|
|
|
|
var searchCriteria logic.SearchCriteria
|
2024-06-12 22:37:13 +00:00
|
|
|
|
|
|
|
searchCriteria.SetCode = GetStringResponse("Set code:")
|
|
|
|
searchCriteria.Foil = GetTriadicResponse("Foil (y/n/E):")
|
|
|
|
searchCriteria.Promo = GetTriadicResponse("Promo (y/n/E):")
|
|
|
|
searchCriteria.Language = GetStringResponse("Language:")
|
|
|
|
shouldRefreshSearch = true
|
2024-09-07 18:07:48 +00:00
|
|
|
|
|
|
|
return searchCriteria
|
2024-06-12 22:37:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func getTriadicDisplay(triadic logic.Triadic) string {
|
|
|
|
if triadic == logic.True {
|
|
|
|
return "True"
|
|
|
|
}
|
|
|
|
|
|
|
|
if triadic == logic.False {
|
|
|
|
return "False"
|
|
|
|
}
|
|
|
|
|
|
|
|
return "Either"
|
|
|
|
}
|
|
|
|
|
2024-09-07 18:07:48 +00:00
|
|
|
func showInsertSearchCriteria(insertSearchCriteria logic.SearchCriteria) {
|
2024-06-12 22:37:13 +00:00
|
|
|
fmt.Println("SEARCH CRITERIA")
|
|
|
|
|
2024-09-07 18:07:48 +00:00
|
|
|
setCodeDisplay := getInfoDisplay(insertSearchCriteria.SetCode)
|
|
|
|
foilDisplay := getTriadicDisplay(insertSearchCriteria.Foil)
|
|
|
|
promoDisplay := getTriadicDisplay(insertSearchCriteria.Promo)
|
|
|
|
languageDisplay := getInfoDisplay(insertSearchCriteria.Language)
|
2024-06-12 22:37:13 +00:00
|
|
|
|
|
|
|
fmt.Println("Set code:", setCodeDisplay)
|
|
|
|
fmt.Println("Foil:", foilDisplay)
|
|
|
|
fmt.Println("Promo:", promoDisplay)
|
|
|
|
fmt.Println("Language:", languageDisplay)
|
|
|
|
|
|
|
|
fmt.Print("\n")
|
|
|
|
}
|
|
|
|
|
|
|
|
func showSelectedCard() {
|
|
|
|
selectedCardDisplay := getInfoDisplay(selectedCardPrintingSearchLine)
|
|
|
|
fmt.Println("Selected card:", selectedCardDisplay)
|
|
|
|
}
|
|
|
|
|
2024-09-07 18:07:48 +00:00
|
|
|
func getSearchOptions(db *sql.DB, insertSearchCriteria logic.SearchCriteria) logic.InsertSearchOptions {
|
|
|
|
options, err := logic.GetAllSearchOptions(db, insertSearchCriteria)
|
|
|
|
logic.Check(err)
|
|
|
|
shouldRefreshSearch = false
|
|
|
|
return options
|
2024-06-12 22:37:13 +00:00
|
|
|
}
|