Problem search multiple categories

Problem search multiple categories

Postby ethanb on Sat Aug 22, 2009 9:57 pm

I don't see a reason why the Genre search list couldn't be checkboxes instead of radio buttons - that way you could search for, say, Joseki and Fuseki problems instead of just one or the other.
ethanb
 
Posts: 6
Joined: Thu Jul 09, 2009 2:31 pm

Re: Problem search multiple categories

Postby nait on Thu Nov 12, 2009 2:54 pm

Very much so :!: :!:

In status, this should also enable the option "tried" AND "not solved" which I would find very natural to use a lot.
In status, some combinations would make little sense, though (e.g. tried AND not tried). So, here, the common options could as well be radio buttons still, but with all the combinations that make sense:

- Any
- Tried and never failed / always solved
- Tried and failed as well as solved
- Tried and never solved / always failed
- Not tried
- Tried or not tried, but never solved

As it is, "not solved" means the latter, but this is not very clear when you read it.
nait
 
Posts: 1
Joined: Wed Apr 08, 2009 1:24 pm

Re: Problem search multiple categories

Postby tails on Sat Nov 14, 2009 3:40 am

Hi. As an easy solution, I have added "Tried but unsolved" status.
tails
 
Posts: 90
Joined: Thu Oct 23, 2008 12:10 pm

Re: Problem search multiple categories

Postby ethanb on Sun Dec 13, 2009 7:32 am

Er, sorry, but this is not a solution at all. (EDIT: oh, I see - nait suggested a new radio button for the solved status separate from the checkbox idea. In any case, the pseudocode below should help with the checkbox genre implementation.)

Rather than a new flag, it should be combinations of flags that are allowed. The site is in PHP, and I assume an SQL backend, so it would be something like:

(on pages)
Code: Select all
<input type="checkbox" name="genre[]" value="joseki">Joseki
<input type="checkbox" name="genre[]" value="fuseki">Fuseki
<input type="checkbox" name="genre[]" value="lifendeath">Life and Death
<input type="checkbox" name="genre[]" value="tesuji">Tesuji
etc...


and in the PHP:
Code: Select all
$sql = "SELECT * from problems ";
if ($_POST["genre"])
{
  $sql += "WHERE ";
  for ($i = 0; $i < sizeof($_POST["genre"]); $i++)
  {
    $sql += "genre = '" + $_POST["genre"][$i] + "'";
    if ($i < sizeof($_POST["genre"]))
      $sql += " OR ";
  }
}
$sql += ";";


Note that my PHP + HTML is a bit rusty, so there may be errors, but this is at least very close.
ethanb
 
Posts: 6
Joined: Thu Jul 09, 2009 2:31 pm

Re: Problem search multiple categories

Postby tails on Sun Dec 13, 2009 11:09 am

Yes, that's technically possible.

But I think there is a trade-off. Assume all the boxes are checked inintially. When you want joseki problems, you'll have to turn off all the boxes except joseki one. I think some people may feel it annoying.

I (as a mere maintener) can't decide which is better, so I must respect the fact that adum chose radio buttons. That's why I didn't implement your idea, sorry.
tails
 
Posts: 90
Joined: Thu Oct 23, 2008 12:10 pm

Re: Problem search multiple categories

Postby adum on Mon Dec 14, 2009 12:56 pm

i agree that checkboxes would probably be superior... especially for the tried/solved type stuff. it's probably radio buttons for the simple reason that i didn't think the design through carefully when i made it originally.
User avatar
adum
Site Admin
 
Posts: 384
Joined: Tue Sep 30, 2008 5:09 pm

Re: Problem search multiple categories

Postby tails on Tue Dec 15, 2009 7:03 pm

Aye aye, sir :-)

Here is a candidate page that uses checkboxs for problem conditions:
http://www.goproblems.com/problems-test1.php3

Please comment if you have any suggestions. > all
tails
 
Posts: 90
Joined: Thu Oct 23, 2008 12:10 pm

Re: Problem search multiple categories

Postby adum on Wed Dec 16, 2009 1:39 pm

looks nice to me... what do others think?
User avatar
adum
Site Admin
 
Posts: 384
Joined: Tue Sep 30, 2008 5:09 pm

Re: Problem search multiple categories

Postby tails on Sun Dec 20, 2009 5:25 am

Okay, I've replaced the page. (The URL above is no longer available.)

The old page will be available for a while at:
http://www.goproblems.com/problems-old.php3
tails
 
Posts: 90
Joined: Thu Oct 23, 2008 12:10 pm

Re: Problem search multiple categories

Postby ethanb on Wed Dec 23, 2009 8:18 am

Awesome! Thanks!
ethanb
 
Posts: 6
Joined: Thu Jul 09, 2009 2:31 pm


Return to Suggestions

Who is online

Users browsing this forum: No registered users and 5 guests

cron