# HG changeset patch # User Matti Hamalainen # Date 1695025246 -10800 # Node ID 14d4d4300623ca479846bea8107be783b4d9f0ea # Parent d82cadd5b4ff0b5a83aa9c1d4d84e723bdf6ee57 quotedb: When searching quotes, inform user if we found more matches than the max matches limit. diff -r d82cadd5b4ff -r 14d4d4300623 config.quotedb.example --- a/config.quotedb.example Tue Sep 05 00:06:17 2023 +0300 +++ b/config.quotedb.example Mon Sep 18 11:20:46 2023 +0300 @@ -123,6 +123,7 @@ "fmt_get" "#@1@: @2@ (@3@/@4@, @5@)" "fmt_search" "#@1@: @2@ (@3@/@4@)" + "num_matches" "@name@-haku löysi @1@ tulosta joista max @2@ näytettiin." "no_matches" "@name@-haku ei tuottanut tuloksia." "you_voted" "Äänestit @name@ #@1@ @2@, arvosana nyt @3@" diff -r d82cadd5b4ff -r 14d4d4300623 quotedb.tcl --- a/quotedb.tcl Tue Sep 05 00:06:17 2023 +0300 +++ b/quotedb.tcl Mon Sep 18 11:20:46 2023 +0300 @@ -440,13 +440,17 @@ ### Query the database and output results set uresults 0 + set usql "SELECT count(*) AS uresults FROM $utable $fquery" + qdb_handle eval $usql {} + set usql "SELECT id AS quoteID, utime AS utime, utext AS utext, user AS uuser FROM $utable $fquery ORDER BY utime DESC LIMIT $ulimit" qdb_handle eval $usql { - incr uresults qdb_msg $ucmd $utable $upublic $unick $uchan "fmt_search" [list $quoteID $utext $uuser [qdb_ctime $utime]] } - if {$uresults == 0} { + if {$uresults > $ulimit} { + qdb_msg $ucmd $utable $upublic $unick $uchan "num_matches" [list $uresults $ulimit] + } elseif {$uresults == 0} { qdb_msg $ucmd $utable $upublic $unick $uchan "no_matches" return 0 }