Changeset 11302
- Timestamp:
- 05/09/08 21:40:47 (5 years ago)
- Location:
- websites/jwatch.jp/trunk
- Files:
-
- 28 added
- 11 modified
-
lib/JWatch.pm (modified) (1 diff)
-
lib/JWatch/Controller/Root.pm (modified) (2 diffs)
-
lib/JWatch/Schema (added)
-
lib/JWatch/Schema.pm (modified) (1 diff)
-
lib/JWatch/Schema/Club.pm (added)
-
lib/JWatch/Schema/Event.pm (added)
-
lib/JWatch/Schema/Game.pm (added)
-
lib/JWatch/Schema/GameOfficial.pm (added)
-
lib/JWatch/Schema/GamePlayer.pm (added)
-
lib/JWatch/Schema/Official.pm (added)
-
lib/JWatch/Schema/Player.pm (added)
-
lib/JWatch/Schema/Stadium.pm (added)
-
lib/JWatch/View/TT.pm (added)
-
misc/jwatch_create.sql (modified) (7 diffs)
-
misc/jwatch_fixdata.sql (modified) (2 diffs)
-
misc/load_club_player_from_j.pl (modified) (1 diff)
-
misc/load_game_from_jsgoal.pl (modified) (3 diffs)
-
misc/load_official_from_j.pl (modified) (1 diff)
-
misc/load_schedule_from_jsgoal.pl (modified) (2 diffs)
-
misc/load_stadium_from_jsgoal.pl (modified) (1 diff)
-
misc/update_game_from_jsgoal.pl (added)
-
misc/update_player_from_j.pl (modified) (1 diff)
-
root/lib (added)
-
root/lib/config (added)
-
root/lib/config/col (added)
-
root/lib/config/main (added)
-
root/lib/config/url (added)
-
root/lib/site (added)
-
root/lib/site/footer (added)
-
root/lib/site/header (added)
-
root/lib/site/html (added)
-
root/lib/site/layout (added)
-
root/lib/site/wrapper (added)
-
root/src (added)
-
root/src/error.tt2 (added)
-
root/src/index.tt2 (added)
-
root/src/message.tt2 (added)
-
root/src/ttsite.css (added)
-
root/src/welcome.tt2 (added)
Legend:
- Unmodified
- Added
- Removed
-
websites/jwatch.jp/trunk/lib/JWatch.pm
r10949 r11302 14 14 # directory 15 15 16 use Catalyst qw/-Debug ConfigLoader Static::Simple/; 16 use Catalyst qw/ 17 -Debug 18 ConfigLoader 19 Static::Simple 20 21 Unicode 22 /; 17 23 18 24 our $VERSION = '0.01'; -
websites/jwatch.jp/trunk/lib/JWatch/Controller/Root.pm
r10949 r11302 3 3 use strict; 4 4 use warnings; 5 use utf8; 5 6 use base 'Catalyst::Controller'; 6 7 … … 34 35 } 35 36 37 sub index : Private { 38 my ( $self, $c ) = @_; 39 40 my @list = $c->model('DBIC')->resultset('Event')->search( 41 {}, 42 { 43 rows => 40, 44 order_by => 'datetime desc', 45 join => 'game', 46 } 47 ); 48 for my $event (@list) { 49 my $game = $event->game; 50 my @score= $c->model('DBIC')->resultset('Event')->search( 51 { 52 gameid => $event->gameid, 53 gametime => { '<=' => $event->gametime }, 54 type => 'goal', 55 }, 56 { 57 select => [ 58 { count => 'clubid' }, 59 'clubid', 60 ], 61 as => [qw(score clubid)], 62 group_by => 'clubid', 63 } 64 ); 65 my %score = map {( $_->clubid, $_->get_column('score') )} @score; 66 $event->{gamedesc} = join (' ', 67 $game->homeclub->shortname, 68 $score{$game->clubid_home} || '0', 69 '-', 70 $score{$game->clubid_away} || '0', 71 $game->awayclub->shortname, 72 ); 73 $event->{referee} = $game->officials({type => 'referee'})->next; 74 $event->{referee}->{shortname} = (split(' ', $event->{referee}->name))[0]; 75 for my $player (qw(player1 player2)) { 76 $event->$player or next; 77 my $name = $c->model('DBIC')->resultset('Player')->find( 78 { 79 year => $game->kickoff->year, 80 clubid => $event->clubid, 81 number => $event->$player, 82 },{ 83 order_by => 'serialno desc', 84 rows => 1, 85 } 86 )->name; 87 $event->{$player.'name'} = join ('', 88 '#',$event->$player, 89 (split(' ', $name))[0] 90 ); 91 } 92 } 93 $c->stash->{eventlist} = \@list; 94 $c->stash->{template} = 'index.tt2'; 95 96 } 97 36 98 =head2 end 37 99 -
websites/jwatch.jp/trunk/lib/JWatch/Schema.pm
r11217 r11302 2 2 3 3 use strict; 4 use base qw/DBIx::Class::Schema::Loader/;4 use warnings; 5 5 6 __PACKAGE__->loader_options( 7 relationships => 1, 8 # debug => 1, 9 components => [qw( 10 InflateColumn::DateTime 11 )], 12 ); 6 use base 'DBIx::Class::Schema'; 13 7 14 =head1 NAME 8 __PACKAGE__->load_classes; 15 9 16 JWatch::Schema - DBIx::Class::Schema::Loader class17 10 18 =head1 SYNOPSIS 11 # Created by DBIx::Class::Schema::Loader v0.04004 @ 2008-05-09 19:54:05 12 # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:OgmUik4aXXMY1Ed5TMMoKw 19 13 20 See L<JWatch>21 14 22 =head1 DESCRIPTION 23 24 Generated by L<Catalyst::Model::DBIC::Schema> for use in L<JWatch::Model::DBIC> 25 26 =head1 AUTHOR 27 28 A clever guy 29 30 =head1 LICENSE 31 32 This library is free software, you can redistribute it and/or modify 33 it under the same terms as Perl itself. 34 35 =cut 36 15 # You can replace this text with custom content, and it will be preserved on regeneration 37 16 1; 38 -
websites/jwatch.jp/trunk/misc/jwatch_create.sql
r11217 r11302 1 1 -- vim: ft=mysql 2 2 DROP DATABASE IF EXISTS jwatch; 3 CREATE DATABASE jwatch ;3 CREATE DATABASE jwatch default character set utf8; 4 4 5 5 use jwatch; 6 6 create table `club` ( 7 clubid int not null default 0 primary key,7 id int not null default 0 primary key, 8 8 shortname tinytext, 9 9 name tinytext, … … 25 25 26 26 create table `official` ( 27 officialid tinyint not null auto_increment primary key,27 id tinyint not null auto_increment primary key, 28 28 name tinytext, 29 29 name_i18n tinytext … … 31 31 32 32 create table `stadium` ( 33 stadiumid int not null primary key,33 id int not null primary key, 34 34 name tinytext, 35 35 name_i18n tinytext … … 37 37 38 38 create table `game` ( 39 gameid decimal(20) not null default 0primary key,39 id char(20) not null default '' primary key, 40 40 category tinyint, 41 41 gameno tinyint, … … 44 44 clubid_away int, 45 45 stadiumid int, 46 score_home tinyint ,47 score_away tinyint 46 score_home tinyint default null, 47 score_away tinyint default null 48 48 ); 49 49 50 50 create table `game_player` ( 51 `gameid` decimal(20) not null default 0,51 `gameid` char(20) not null default '', 52 52 `clubid` int not null default 0, 53 53 `number` tinyint not null default 0, … … 60 60 61 61 create table `game_official` ( 62 gameid decimal(20) not null default 0,62 gameid char(20) not null default '', 63 63 officialid tinyint not null default 0, 64 64 `type` enum('referee', 'assistant', 'fourth'), … … 67 67 68 68 create table event ( 69 ` eventid` int not null auto_increment primary key,70 `gameid` decimal(20) not null default 0,69 `id` int not null auto_increment primary key, 70 `gameid` char(20) not null default '', 71 71 `gametime` tinyint not null default 0, 72 72 `datetime` datetime, 73 `type` enum('goal', 'yellow', 'red', 'change', 'other' ),73 `type` enum('goal', 'yellow', 'red', 'change', 'other', 'member', 'end'), 74 74 `clubid` int, 75 75 `player1` tinyint, -
websites/jwatch.jp/trunk/misc/jwatch_fixdata.sql
r11217 r11302 1 use jwatch; 1 2 update player set 2 3 name = '森崎 浩司' … … 20 21 name = '高地 系治' 21 22 where clubid = 44 and year = 2008 and number = 6; 23 update player set 24 name = '楢崎 正剛' 25 where clubid = 8 and year = 2008 and number = 1; -
websites/jwatch.jp/trunk/misc/load_club_player_from_j.pl
r11217 r11302 71 71 my $res = $scraper->scrape(URI->new($memberurl)); 72 72 return { 73 clubid => int $clubid,73 id => int $clubid, 74 74 category => int $category, 75 75 shortname => $shortname, -
websites/jwatch.jp/trunk/misc/load_game_from_jsgoal.pl
r11217 r11302 34 34 for ($games->search({kickoff => {'<' => DateTime->now}})) { 35 35 $game = $_; 36 $gameid = $game-> gameid;36 $gameid = $game->id; 37 37 $kickoff = $game->kickoff; 38 38 my $uri = URI->new( … … 128 128 } 129 129 if ($player1 eq 'オウンゴ−ル') { 130 $description = $player1;130 $description = 'own goal'; 131 131 $player1 = ''; 132 132 } else { … … 149 149 my @cell = $_->look_down(_tag => 'td'); 150 150 $type = ($cell[0]->as_text eq '主審') ? 'referee' : 'assistant'; 151 my $officialid = $officials->find({name => $cell[-1]->as_text})-> officialid;151 my $officialid = $officials->find({name => $cell[-1]->as_text})->id; 152 152 return { 153 153 gameid => $gameid, -
websites/jwatch.jp/trunk/misc/load_official_from_j.pl
r11217 r11302 31 31 $name_i18n eq 'Name' and return; 32 32 return { 33 officialid => ++$officialid,33 id => ++$officialid, 34 34 name => $cell[1]->as_trimmed_text, 35 35 name_i18n => $name_i18n, -
websites/jwatch.jp/trunk/misc/load_schedule_from_jsgoal.pl
r11217 r11302 62 62 $strp->parse_datetime($kickoff) 63 63 ); 64 my $clubid_home = $clubs->find({shortname => $cell[1]->as_text})-> clubid;65 my $clubid_away = $clubs->find({shortname => $cell[3]->as_text})-> clubid;64 my $clubid_home = $clubs->find({shortname => $cell[1]->as_text})->id; 65 my $clubid_away = $clubs->find({shortname => $cell[3]->as_text})->id; 66 66 my $stadiumlink = $cell[4]->look_down(_tag => 'a'); 67 67 my $stadiumid = URI->new($stadiumlink->attr('href'))->query_param('s') if $stadiumlink; 68 68 return { 69 gameid => $gameid || '',69 id => $gameid || '', 70 70 category => $category, 71 71 gameno => $gameno, … … 74 74 clubid_away => $clubid_away, 75 75 stadiumid => $stadiumid || 0, 76 score_home => $score_home || 0,77 score_away => $score_away || 0,76 score_home => defined $score_home ? $score_home : undef, 77 score_away => defined $score_away ? $score_away : undef, 78 78 }; 79 79 } -
websites/jwatch.jp/trunk/misc/load_stadium_from_jsgoal.pl
r11217 r11302 26 26 my $stadiumid = URI->new($a->attr('href'))->query_param('s'); 27 27 return { 28 stadiumid => int $stadiumid,28 id => int $stadiumid, 29 29 name => $a->as_trimmed_text, 30 30 }; -
websites/jwatch.jp/trunk/misc/update_player_from_j.pl
r11217 r11302 25 25 for my $info (reverse @infolist) { 26 26 my $date = delete $info->{date}; 27 my $clubid = $schema->resultset('Club')->find({name => $info->{clubname}})-> clubid;27 my $clubid = $schema->resultset('Club')->find({name => $info->{clubname}})->id; 28 28 my $name; 29 29 my $player = $schema->resultset('Player')->find(
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)