Hi,
* On 2007-09-03 Greg Matheson via RT (bug-Games-Tournament-Swiss@rt.cpan.org) wrote:
Show quoted text> [...]
> > Note: I've read your mail about crosstable and pairingtable being like
> > proofs of concept. But they are very useful, so I decided to write
> > this mail nevertheless. I've found no other way to contact you than
> > submitting a new bug. Perhaps the problem I discoverd is not even a
> > bug. In that case please close this bug report as soon as possible.
>
> I'd like to keep this conversation public, because I think it
> might be useful to others. If there is something that you feel
> you can't talk about publicly, I guess we could do something,
> but I don't think there is anything like that at the moment.
> There is not enough interest from others to justify a mailing
> list.
It's fine for me as it is. I just wanted to be sure I choosed the
right way to ask questions or make suggestions about your module.
Show quoted text> > I'll describy shortly were the problem occurs: To use your module for
> > managing a tournament I would like to create the directory structure
> > first (that is, creating empty subdirectories for single rounds,
> > creating empty scores subdirectory and creating empty file
> > league.yaml). Afterwards (as the tournament goes on) those directories
> > and files could be filled with content step by step.
>
> Why do you want to do it that way, rather than as you go? Though
> I guess there is no reason not to try and make this possible.
Well, actually I see no convincing reason to prefer the order
described in my last post. But anyway, I think an existing empty
subdirectory shouldn't stop the script to work properly. But see
below about the question how the correct round number could be
detected by the script.
Show quoted text> > The problem arises when trying to create a crosstable after let's say
> > the first round. There are data files in subdirectory "1/" and there
> > is the file "scores/1.yaml". Subdirectories "2/", "3/" etc. are still
> > empty.
>
> > Somehow crosstable doesn't recognize it should omit rounds 2, 3 etc.
> > Instead it fails, complaining about being unable to open
> > ./2/tourney.yaml.
>
> > The reason seems to be line 57/58 in crosstable:
>
> > 55 for my $file ( glob ('./*') )
> > 56 {
> > 57 push @rounds, $1 if -d $file and $file =~ m/\/(\d+)$/ and
> > 58 glob( "./$file/* " );
> > 59 }
>
> > The last test
>
> > glob( "./$file/* ")
>
> > doesn't seem to recognize that directory 2 (and others) are empty. I'm
> > not sure about this, but maybe it returns "true" in the context
> > given -- even though there aren't any files matched?
>
> > However, in my opinion a smarter test would be
>
> > -e "./scores/$1.yaml"
>
> > which tests whether there are already results for the given round. The
> > relevant section of crosstable would read like:
>
> > 55 for my $file ( glob ('./*') )
> > 56 {
> > 57 push @rounds, $1 if -d $file and $file =~ m/\/(\d+)$/ and
> > 58 -e "./scores/$1.yaml";
> > 59 }
>
> > The same applies to pairingtable (line 54/55 there).
>
> > What do you think -- would it be sensible to change the relevant
> > lines?
>
> I think my reasoning for doing it this way was that it was very
> clear how many rounds had been played. If no subdirectories
> existed, there couldn't be any more rounds.
Okay, point taken. I thought the test
glob( "./$file/* ")
was designed to ignore empty subdirectory? But propably I didn't get
that right.
But what about the situation when the pairings for a new round were
generated (files in subdirectory $round/) but there aren't any results
yet (no file $round.yaml in scores)? I would argue that running
crosstable should generate the crosstable before that round.
Show quoted text> If you make it possible to run the script in a less clear
> situation, for example with incomplete score files,
> half-filled-out before the round has been played, or old
> serialization files, in a 'replay' of the tournament, it's more
> likely to fail.
I see, though I wonder if relying on the round subdirectories isn't a
bit fault-prone itself.
Show quoted text> > Actually I would prefer to go a step further and implement an option
> > to pass crosstable and pairingtable a round number as an argument. The
> > scripts then compute those tables for that round. If no round number
> > is passed as an argument, the last round with results (taken from the
> > "scores" subdirectory) should be assumed.
>
> If we are going to go that route, it might be better to require
> the round. I guess I didn't want to do that because I didn't want
> to have to remember the round!
The reason for my suggestion was, that I thought, "crosstable" and
"pairingtable" could be used in two modes. One mode (the "main mode")
would be used for actual tournament management -- in that case always
the current crosstable or pairingtable should be computed and no round
number is required. But in a second mode (maybe "replay mode") the
scripts could be able to compute crosstables or pairingtables for past
rounds -- dependent on the round number given.
Show quoted text> Actually something I have wanted more than this is the ability to
> run the scripts either in the tournament directory or the round
> subdirectory.
Probably very crude, but couldn't one add a line like
chdir('..') if ((! -d './scores') and (-e '../league.yaml'));
at the beginning of the scripts?
Show quoted text> > Of course I can do that locally, but maybe it's useful for others as
> > well.
>
> Do you think most people would prefer to prepare their round
> subdirectories first? [...]
No I wouldn't count on that. It's just the way I went for my web
frontend. [At the moment it's really very simple but it's running fine
locally. I still have to clean the code and to move it to a web
server. Furthermore it's still in German.] But for that application I
can tweak your scripts as I need. Basically what it does is:
* There is one CGI script which serves to set up tournaments, to
choose an existing tournament and to delete tournaments. While
setting up a tournament one has to specify the number of rounds and
after that all subdirectories are created as described.
* There is a second CGI script which allows managing a single
tournament. One can view, add and delete participants, create new
pairings, fill in results, view old results and view crosstables for
a given round. And of course one can return to the first script (for
instance to switch tournaments).
Show quoted text> All that said, if you submit a patch with this change, prepared
> like with 'diff -u pairingtable.orig pairingtable', I'll apply
> it.
Well, I'm not sure it's really an improvement. But nevertheless I
attach the patches generated by
diff -u crosstable.orig crosstable > patch.crosstable.0.06
and
diff -u pairingtable.orig pairingtable > patch.pairingtable.0.06
It's fine if you ignore them ;-)
Best regards
Christian