]> iEval git - plack-app-gruntmaster.git/commitdiff
Add more information to user page
authorMarius Gavrilescu <marius@ieval.ro>
Fri, 12 Dec 2014 12:17:21 +0000 (14:17 +0200)
committerMarius Gavrilescu <marius@ieval.ro>
Fri, 12 Dec 2014 12:17:21 +0000 (14:17 +0200)
css/custom.css
lib/Plack/App/Gruntmaster/HTML.pm
tmpl/us_entry.en

index 0da7b4ed3fa05fcf15ce688a2c9c4c44909db41d..429955b32bbc6b1ec91189a8d79f5b02bb773a48 100644 (file)
@@ -63,3 +63,19 @@ a.dropdown-toggle{
 nav li{
        padding: 5px;
 }
+
+ul.inline{
+       list-style-type: none;
+}
+
+ul.inline li{
+       display: inline;
+}
+
+ul.inline li:after {
+       content: ", ";
+}
+
+ul.inline li:last-child:after {
+       content: "";
+}
\ No newline at end of file
index a82cafd1cd3ab7023a788bd9463d86673601f6be..45230551f8a391bd2042b08a550e9fd33e8877ca 100644 (file)
@@ -79,6 +79,25 @@ sub process_skel {
 sub process_us_entry {
        my ($tree, %args) = @_;
        $tree->fid($_)->attr('href', "/$_/?owner=$args{id}") for qw/log pb/;
+       my @solved = map { $_->{solved} ? ($_->{problem}) : () } @{$args{problems}};
+       my @attempted = map { !$_->{solved} ? ($_->{problem}) : () } @{$args{problems}};
+
+       my $pbiter = sub {
+               my ($data, $li) = @_;
+               $li->find('a')->namedlink($data);
+       };
+       $tree->fid('solved')->find('li')->iter3(\@solved, $pbiter);
+       $tree->fid('attempted')->find('li')->iter3(\@attempted, $pbiter);
+       $tree->fid('solved_count')->replace_content(scalar @solved);
+       $tree->fid('attempted_count')->replace_content(scalar @attempted);
+
+       my $ctiter = sub {
+               my ($data, $td) = @_;
+               $td->fclass('contest')->namedlink($data->{contest});
+               $td->fclass('score')->replace_content($data->{score});
+               $td->fclass('rank')->replace_content($data->{rank});
+       };
+       $tree->find('table')->find('tbody')->find('tr')->iter3($args{contests}, $ctiter);
 }
 
 sub process_us {
index 413e8978dbb6c43b6e2097bd3b1db308a8fb316c..62748d5b7b6f8f0e64911bc4b403cb4a4b63b617 100644 (file)
@@ -4,5 +4,19 @@
 <dt>Level</dt> <dd smap="level">Level</dd>
 </dl>
 
+<h1>Solved problems</h1>
+Total <strong id="solved_count">1</strong>
+<ul class="inline" id="solved"><li><a href="/pb/id">problem_id</a></ul>
+
+<h1>Attempted problems</h1>
+Total <strong id="attempted_count">1</strong>
+<ul class="inline" id="attempted"><li><a href="/pb/id">problem_id</a></ul>
+
+<h1>Contest results</h1>
+<table class="table table-bordered table-striped">
+<thead><tr><th>Contest<th>Score<th>Rank</thead>
+<tbody><tr><td class="contest"><a href="/ct/id">Test<td class="score">1000<td class="rank">1</tbody>
+</table>
+
 <a href="/log/?owner=id" id="log">Job log</a><br>
 <a href="/pb/?owner=id" id="pb">Owned problems</a>
This page took 0.027403 seconds and 4 git commands to generate.