Skip Menu |

This queue is for tickets about the Games-Tournament-Swiss CPAN distribution.

Report information

Subject: small tweak for crosstable and pairingtable
Date: Mon, 3 Sep 2007 11:13:45 +0200
To: bug-Games-Tournament-Swiss [...] rt.cpan.org
From: Christian Bartolomaeus <bartolin [...] gmx.de>
Hi, I found a small problem with the scripts crosstable and pairingtable, not working if there were empty directories for future rounds. 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'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. 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? 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. Of course I can do that locally, but maybe it's useful for others as well. Best regards Christian
Subject: Re: [rt.cpan.org #29125] small tweak for crosstable and pairingtable
Date: Tue, 4 Sep 2007 02:41:24 +0000
To: Christian Bartolomaeus via RT <bug-Games-Tournament-Swiss [...] rt.cpan.org>
From: Greg Matheson <drbean [...] freeshell.org>
On Mon, 03 Sep 2007, Christian Bartolomaeus via RT wrote: Show quoted text
> I found a small problem with the scripts crosstable and pairingtable, > not working if there were empty directories for future rounds.
I've been annoyed by this at times too. 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. I think this problem is a good reason for a bug report. 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. 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.
Show quoted text
> Somehow crosstable doesn't recognize it should omit rounds 2, 3 etc. > Instead it fails, complaining about being unable to open > ./2/tourney.yaml.
Show quoted text
> The reason seems to be line 57/58 in crosstable:
Show quoted text
> 55 for my $file ( glob ('./*') ) > 56 { > 57 push @rounds, $1 if -d $file and $file =~ m/\/(\d+)$/ and > 58 glob( "./$file/* " ); > 59 }
Show quoted text
> The last test
Show quoted text
> glob( "./$file/* ")
Show quoted text
> 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?
Show quoted text
> However, in my opinion a smarter test would be
Show quoted text
> -e "./scores/$1.yaml"
Show quoted text
> which tests whether there are already results for the given round. The > relevant section of crosstable would read like:
Show quoted text
> 55 for my $file ( glob ('./*') ) > 56 { > 57 push @rounds, $1 if -d $file and $file =~ m/\/(\d+)$/ and > 58 -e "./scores/$1.yaml"; > 59 }
Show quoted text
> The same applies to pairingtable (line 54/55 there).
Show quoted text
> 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. 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. 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! Actually something I have wanted more than this is the ability to run the scripts either in the tournament directory or the round subdirectory. 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? I doubt there is anyone else using the modules. All that said, if you submit a patch with this change, prepared like with 'diff -u pairingtable.orig pairingtable', I'll apply it.
Subject: Re: [rt.cpan.org #29125] small tweak for crosstable and pairingtable
Date: Tue, 4 Sep 2007 09:51:59 +0200
To: Greg Matheson via RT <bug-Games-Tournament-Swiss [...] rt.cpan.org>
From: Christian Bartolomaeus <bartolin [...] gmx.de>
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

Message body is not shown because sender requested not to inline it.

Message body is not shown because sender requested not to inline it.

Subject: Re: [rt.cpan.org #29125] small tweak for crosstable and pairingtable
Date: Mon, 17 Sep 2007 21:16:43 +0200
To: Greg Matheson via RT <bug-Games-Tournament-Swiss [...] rt.cpan.org>
From: Christian Bartolomaeus <bartolin [...] gmx.de>
Hi, * On 2007-09-04 Christian Bartolomaeus (bartolin@gmx.de) wrote: 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. > [...]
> > 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 [...]
with version 0.08 I can pass 'crosstable' and 'pairingtable' the round number as an argument as I wanted to do. For me this works fine. Therefore I think this bug report could be closed. Thanks Christian
Download signature.asc
application/pgp-signature 189b

Message body not shown because it is not plain text.

Subject: Re: [rt.cpan.org #29125] small tweak for crosstable and pairingtable
Date: Tue, 18 Sep 2007 00:11:31 +0200
To: Greg Matheson via RT <bug-Games-Tournament-Swiss [...] rt.cpan.org>
From: Christian Bartolomaeus <bartolin [...] gmx.de>
Hi Greg, before you close this bug report, I just wanted to add one note about the web frontend, I wrote about: * On 2007-09-04 Christian Bartolomaeus (bartolin@gmx.de) wrote: 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.
> > [...] >
> > 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).
I just managed to install those two scripts on a webserver. They are very simple, but one can do some basic things like adding and removing participants and pairing rounds. The perl code is probably very ugly and the documentation must be improved (just discovered POD ;-). But hey -- it works. If you are curious and would like to have a look, I can give you access to my test installation and send you the scripts. But I would like to do that via private mail, because I don't want to post the access data here. If you're not interested, please ignore this post. Best regards Christian
Download signature.asc
application/pgp-signature 189b

Message body not shown because it is not plain text.

Subject: Re: [rt.cpan.org #29125] small tweak for crosstable and pairingtable
Date: Wed, 19 Sep 2007 04:19:10 +0000
To: Christian Bartolomaeus via RT <bug-Games-Tournament-Swiss [...] rt.cpan.org>
From: Greg Matheson <drbean [...] freeshell.org>
Replying through the bug tracker. On Mon, 17 Sep 2007, Christian Bartolomaeus via RT wrote: Show quoted text
> I just managed to install those two scripts on a webserver.
The web site is very nice. For an arbiter it would be the most convenient way to work. I found it quite easy to enter many entrants. Perhaps that was because of the browser I was using. When you have time, I encourage you to take out the call to pair and access the Games::Tournament::Swiss modules themselves. It must be slower invoking perl twice. Solving problems you have doing this will improve the modules. And perhaps you don't want to use YAML. There is no YAML in the modules themselves, only in the scripts.
Subject: Re: [rt.cpan.org #29125] small tweak for crosstable and pairingtable
Date: Wed, 19 Sep 2007 08:41:18 +0200
To: Greg Matheson via RT <bug-Games-Tournament-Swiss [...] rt.cpan.org>
From: Christian Bartolomaeus <bartolin [...] gmx.de>
* On 2007-09-19 Greg Matheson via RT (bug-Games-Tournament-Swiss@rt.cpan.org) wrote: Show quoted text
> [...]
> > I just managed to install those two scripts on a webserver.
> > The web site is very nice. For an arbiter it would be the most > convenient way to work.
Thanks for taking a look! Show quoted text
> I found it quite easy to enter many entrants. Perhaps that was > because of the browser I was using.
Maybe you are right and it works convinient as it is. But I have to add some code to prevent that the list of players couldn't be changed (perhaps accidentally) once the tournament is started. An exception would be to remove a player from the tournament. Show quoted text
> When you have time, I encourage you to take out the call to pair > and access the Games::Tournament::Swiss modules themselves. > > It must be slower invoking perl twice. > > Solving problems you have doing this will improve the modules.
I'll definitely try to do that. But it may take some time. Show quoted text
> And perhaps you don't want to use YAML. There is no YAML in the > modules themselves, only in the scripts.
Yes, I'll think about that. I noticed that you are reducing reliance on the YAML serialization files (as is noted in your README file). But on the other hand I would like to keep my web frontend compatible with the scripts you distribute with Games::Tournament::Swiss. So I won't invent something completely different from your approach. Best regards Christian
Download signature.asc
application/pgp-signature 189b

Message body not shown because it is not plain text.

Subject: Re: [rt.cpan.org #29125] small tweak for crosstable and pairingtable
Date: Wed, 19 Sep 2007 06:58:42 +0000
To: Christian Bartolomaeus via RT <bug-Games-Tournament-Swiss [...] rt.cpan.org>
From: Greg Matheson <drbean [...] freeshell.org>
On Wed, 19 Sep 2007, Christian Bartolomaeus via RT wrote: Show quoted text
> But on the other hand I would like to keep my web frontend compatible > with the scripts you distribute with Games::Tournament::Swiss. So I > won't invent something completely different from your approach.
Actually that might be better because it would give the modules more of a work-out. The only reason for compatibility would be when importing and exporting data. Then a standard format that other software (and people) could use would be the best. But that's a topic for a later time, so I'm going to close this bug report.
added in version 0.08, revision 1338,1340
Subject: Re: [rt.cpan.org #29125] small tweak for crosstable and pairingtable
Date: Thu, 17 Jul 2008 10:19:23 +0200
To: Greg Matheson via RT <bug-Games-Tournament-Swiss [...] rt.cpan.org>
From: Christian Bartolomaeus <bartolin [...] gmx.de>
Hi, this is just a note regarding our earlier discussion. On 2007-09-19, Greg Matheson via RT wrote: Show quoted text
> [...]
> > I just managed to install those two scripts on a webserver.
> > When you have time, I encourage you to take out the call to pair > and access the Games::Tournament::Swiss modules themselves.
I finally came back to my scripts and managed to do just that. The scripts are now working fine without calling 'pair', 'crosstable' or 'pairingtable' -- though I took some code and a lot of ideas from those scripts (and from t/three.t as well). If I continue working on the relevant parts of my scripts I might find some problems with the modules -- in that case I will report them. Show quoted text
> And perhaps you don't want to use YAML. There is no YAML in the > modules themselves, only in the scripts.
I did that as well. Now I use a simple text format for storing pairings and results. Thanks for your advice and best regards Christian P.S. The URL of my scripts didn't change. In case you (or someone else) is interested, I can (re-)send the access data to my test installation or the scripts.
Download signature.asc
application/pgp-signature 189b

Message body not shown because it is not plain text.

Subject: Re: [rt.cpan.org #29125] Resolved: small tweak for crosstable and pairingtable
Date: Sun, 2 Aug 2009 16:36:03 +0200
To: Dr Bean via RT <bug-Games-Tournament-Swiss [...] rt.cpan.org>
From: Christian Bartolomaeus <bartolin [...] gmx.de>
* On 2007-09-19 Dr Bean via RT (bug-Games-Tournament-Swiss@rt.cpan.org) wrote: Show quoted text
> <URL: http://rt.cpan.org/Ticket/Display.html?id=29125 > > > According to our records, your request has been resolved. If you have any > further questions or concerns, please respond to this message.
It seems that I unintentionally reopened this bug report last year. You can close it again. Best regards Christian
Download signature.asc
application/pgp-signature 189b

Message body not shown because it is not plain text.