-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdel_game
executable file
·66 lines (49 loc) · 1.77 KB
/
del_game
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#! /usr/bin/perl -w
# Goat: Gentil Organisateur et Administrateur de Tournois
# Copyright (C) 2006-2018 Yves Rutschle
#
# This program is free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later
# version.
#
# This program is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more
# details.
#
# The full text for the General Public License is here:
# http://www.gnu.org/licenses/gpl.html
=head1 NAME
del_game -- removes a single player pair from current round
=head1 SYNOPSIS
del_game --file <toperm> <player>
=head1 DESCRIPTION
Despite all the automation, sometimes you just need to
remove a game by hand. This typically happens when someone
resigns from the tournament half-round and you re-assign the
remaining player. I<del_game> is designed just for this
purpose.
You only need to specify the e-mail address of one of the
two players. No confirmation is asked, so it's wise to
backup your tournament file before operating.
=cut
use strict;
use Pod::Usage;
use Tournament;
use Getopt::Long;
use GoatConfig;
# Interpret command line
my ($param_black, $param_white, $param_handi, $help);
GetOptions(
'help' => \$help,
) or die pod2usage();
die pod2usage(-verbose=>2) if defined $help;
my $Tournament = Tournament->load($TOURNAMENT_FILE);
my $player = shift;
my $g = $Tournament->find_game_by_email($player);
die "$player not found in $TOURNAMENT_FILE.\n" unless defined $player;
$Tournament->curr_round->del_game($g);
$Tournament->save($TOURNAMENT_FILE);