- 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;
+ local $Gruntmaster::Data::contest = ($_[0] =~ m,^ct/([^/]+)/,)[0];
+ my $htc = HTML::Template::Compiled->new(scalarref => \$templates{$_[1]});
+
+ my @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;
+ }