-);
-
-$templates{$_} = header($_, TITLE) . $templates{$_} for keys %templates;
-$templates{$_} .= footer $_ for keys %templates;
-
-sub generate{
- my ($path, $lang) = @_;
- $path =~ s,/st\.html$,,;
- my $template = $templates{$lang};
- my $htc = HTML::Template::Compiled->new(scalarref => \$template);
- IO::File->new(">$path/meta.yml")->close unless -f "$path/meta.yml";
- flock my $metafh = IO::File->new("<$path/meta.yml"), LOCK_SH;
- my $meta = LoadFile "$path/meta.yml";
- my @problems = sort grep { /^\w+$/ } map { s,.*/,,r } <$path/../pb/*>;
- my %scores;
- for (1 .. $meta->{last}) {
- my $meta = LoadFile "$path/$_/meta.yml";
- if ($meta->{result_text} =~ m/^(\d+)/) {
- $scores{$meta->{user}}{$meta->{problem}} = $1;
- } else {
- $scores{$meta->{user}}{$meta->{problem}} = $meta->{result} ? 0 : 100;
+};
+
+sub _generate{
+ my ($self, $htc, $path, $lang) = @_;
+
+ $path =~ m,^(?:ct/([^/]+)/)?,;
+ local $Gruntmaster::Data::contest = $1;
+
+ my @problems = problems;
+ @problems = sort @problems;
+ my %scores;
+ for (1 .. jobcard) {
+ if (job_result_text =~ m/^(\d+)/) {
+ $scores{job_user()}{job_problem()} = $1;
+ } else {
+ $scores{job_user()}{job_problem()} = job_result() ? 0 : 100;
+ }