Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
bwinf
medal
Commits
e5785c75
Commit
e5785c75
authored
Feb 10, 2020
by
Robert Czechowski
Browse files
Show time until contest opens. Fixes
#51
parent
84e321e4
Pipeline
#374
passed with stages
in 14 minutes and 48 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/core.rs
View file @
e5785c75
...
...
@@ -248,6 +248,17 @@ pub fn show_contest<T: MedalConnection>(conn: &T, contest_id: i32, session_token
}
}
if
let
Some
(
start_date
)
=
c
.start
{
if
time
::
get_time
()
<
start_date
{
data
.insert
(
"can_start"
.to_string
(),
to_json
(
&
false
));
let
time_until
=
start_date
-
time
::
get_time
();
data
.insert
(
"time_until_d"
.to_string
(),
to_json
(
&
(
time_until
.num_days
())));
data
.insert
(
"time_until_h"
.to_string
(),
to_json
(
&
(
time_until
.num_hours
()
%
24
)));
data
.insert
(
"time_until_m"
.to_string
(),
to_json
(
&
(
time_until
.num_minutes
()
%
60
)));
}
}
// This only checks if a query string is existent, so any query string will
// lead to the assumption that a base page is requested. This is usefull to
// disable caching (via random token) but should be changed if query string
...
...
templates/jwinf/contest.hbs
View file @
e5785c75
...
...
@@ -110,7 +110,7 @@
{{#if
participation_start_date
}}
<p>
{{#if
duration
}}
{{#if
time_left
}}
{{#if
time_left
}}
Verbleibenden Zeit:
{{
time_left
}}
{{else}}
Die Zeit ist abgelaufen. Du kannst nun die Aufgaben nicht mehr öffnen.
...
...
@@ -150,9 +150,13 @@
{{/if}}
{{else}}
<p>
Du kannst diesen Wettbewerb im Moment nicht starten.
</p>
{{#if
logged_in
}}
{{else}}
<p>
Möglicherweise musst du dich zunächst
<a
href=
"/login"
>
einloggen
</a>
.
</p>
{{#if
time_until_d
}}
<p>
Der Wettbewerb wird geöffnet in:
{{
time_until_d
}}
Tagen,
{{
time_until_h
}}
Stunden,
{{
time_until_m
}}
Minuten.
{{else}}
{{#if
logged_in
}}
{{else}}
<p>
Möglicherweise musst du dich zunächst
<a
href=
"/login"
>
einloggen
</a>
.
</p>
{{/if}}
{{/if}}
{{/if}}
{{/if}}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment