--- db/prgsrc/writefile.pl 2002/01/15 12:13:55 1.3 +++ db/prgsrc/writefile.pl 2002/01/17 08:00:24 1.4 @@ -1,4 +1,4 @@ -#!perl +#!perl use DBI; @months=('000','Jan',"Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct", "Nov","Dec"); @@ -29,7 +29,7 @@ sub WriteFile { Editors, EnteredBy, PlayedAt, CreatedAt from Tournaments where FileName=".$dbh->quote("$fname.txt"); my $sth=$dbh->prepare($query); - my (%Question,%editor,%qnumber,%copyright,%author,%vid,%tourtitle); + my (%Question,%editor,%qnumber,%copyright,%author,%vid,%tourtitle,%info); $sth->execute; my ($Id, $Title, $Copyright, $Info, $URL, $Editors, $EnteredBy, $PlayedAt, $CreatedAt)= @@ -51,13 +51,13 @@ sub WriteFile { print OUT "Обработан:\n$EnteredBy\n\n" if $EnteredBy; - $query= "SELECT Id, Title, Copyright, Editors, PlayedAt from Tournaments where ParentId=$Id order by Id"; + $query= "SELECT Id, Title, Copyright, Editors, PlayedAt, Info from Tournaments where ParentId=$Id order by Id"; $sth=$dbh->prepare($query); $sth->execute; my ($tourid,$tourtitle,$cright,$editor,@tours,$vid,$author,$tourauthor); - while (($tourid,$tourtitle,$cright,$editor,$date)=$sth->fetchrow,$tourid) + while (($tourid,$tourtitle,$cright,$editor,$date,$info)=$sth->fetchrow,$tourid) { # $text{$tourid}="Тур:\n$tourtitle\n\n"; $query= "SELECT * from Questions where ParentId=$tourid order by QuestionId"; @@ -66,6 +66,7 @@ sub WriteFile { push(@tours,$tourid); $tourtitle{$tourid}=$tourtitle; $copyright{$tourid}=$cright; + $info{$tourid}=$info; $editor{$tourid}=$editor; $date{$tourid}=$date if $date; $vid=''; @@ -113,6 +114,7 @@ sub WriteFile { my $eqvid=1; my $eqauthor=1; my $eqdate=1; + my $eqinfo=1; $date=''; @@ -133,6 +135,12 @@ sub WriteFile { { $eqdate=0; } + $info||=$info{$_}; + if (!$info{$_} || ($info{$_} ne $info)) + { + $eqinfo=0; + } + } print OUT "Вид:\n$vid\n\n" if $eqvid; print OUT "Автор:\n$author\n\n" if $eqauthor; @@ -143,7 +151,8 @@ sub WriteFile { print OUT "Вид:\n$vid{$tour}\n\n" if !$eqvid; print OUT "Копирайт:\n$copyright{$tour}\n\n" if $copyright{$tour} && ($copyright{$tour} ne $Copyright); print OUT "Редактор:\n$editor{$tour}\n\n" if $editor{$tour} && ($editor{$tour} ne $Editors); - print OUT "Дата:\n".PrintDate($date{$tour})."\n\n" if $date{$tour} && (!$eqdate || !$PlayedAt); + print OUT "Дата:\n".PrintDate($date{$tour})."\n\n" if $date{$tour} && (!$eqdate || !$PlayedAt || $PlayedAt ne $date{$tour}); + print OUT "Инфо:\n$info{$tour}\n\n" if $info{$tour} && (!$eqinfo || !$Info || $Info ne $info{$tour}); $tourauthor=0; if (!$eqauthor && $author{$tour}) {