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
8a4af9c7
Commit
8a4af9c7
authored
Oct 25, 2019
by
Robert Czechowski
Browse files
Set removed contests to hidden (public = false) and only show public contests
parent
01a1be83
Changes
6
Show whitespace changes
Inline
Side-by-side
src/core.rs
View file @
8a4af9c7
...
@@ -152,6 +152,7 @@ pub fn show_contests<T: MedalConnection>(conn: &T, session_token: &str, visibili
...
@@ -152,6 +152,7 @@ pub fn show_contests<T: MedalConnection>(conn: &T, session_token: &str, visibili
duration
:
c
.duration
,
duration
:
c
.duration
,
public
:
c
.public
,
public
:
c
.public
,
tasks
:
Vec
::
new
()
})
tasks
:
Vec
::
new
()
})
.filter
(|
ci
|
ci
.public
)
.filter
(|
ci
|
ci
.duration
==
0
||
visibility
!=
ContestVisibility
::
Open
)
.filter
(|
ci
|
ci
.duration
==
0
||
visibility
!=
ContestVisibility
::
Open
)
.filter
(|
ci
|
ci
.duration
!=
0
||
visibility
!=
ContestVisibility
::
Current
)
.filter
(|
ci
|
ci
.duration
!=
0
||
visibility
!=
ContestVisibility
::
Current
)
.collect
();
.collect
();
...
@@ -309,7 +310,11 @@ pub fn show_contest_results<T: MedalConnection>(conn: &T, contest_id: i32, sessi
...
@@ -309,7 +310,11 @@ pub fn show_contest_results<T: MedalConnection>(conn: &T, contest_id: i32, sessi
userresults
[
0
]
=
format!
(
"{}"
,
summe
);
userresults
[
0
]
=
format!
(
"{}"
,
summe
);
groupresults
.push
((
format!
(
"{} {}"
,
user
.firstname
.unwrap_or_default
(),
user
.lastname
.unwrap_or_else
(||
"–"
.to_string
())),
user
.id
,
userresults
))
groupresults
.push
((
format!
(
"{} {}"
,
user
.firstname
.unwrap_or_default
(),
user
.lastname
.unwrap_or_else
(||
"–"
.to_string
())),
user
.id
,
userresults
))
}
}
results
.push
((
format!
(
"{}"
,
group
.name
),
group
.id
.unwrap_or
(
0
),
groupresults
));
results
.push
((
format!
(
"{}"
,
group
.name
),
group
.id
.unwrap_or
(
0
),
groupresults
));
...
...
src/db_conn.rs
View file @
8a4af9c7
...
@@ -48,6 +48,8 @@ pub trait MedalConnection {
...
@@ -48,6 +48,8 @@ pub trait MedalConnection {
fn
get_groups
(
&
self
,
session_id
:
i32
)
->
Vec
<
Group
>
;
fn
get_groups
(
&
self
,
session_id
:
i32
)
->
Vec
<
Group
>
;
fn
get_groups_complete
(
&
self
,
session_id
:
i32
)
->
Vec
<
Group
>
;
fn
get_groups_complete
(
&
self
,
session_id
:
i32
)
->
Vec
<
Group
>
;
fn
get_group_complete
(
&
self
,
group_id
:
i32
)
->
Option
<
Group
>
;
fn
get_group_complete
(
&
self
,
group_id
:
i32
)
->
Option
<
Group
>
;
fn
reset_all_contest_visibilities
(
&
self
);
}
}
pub
trait
MedalObject
<
T
:
MedalConnection
>
{
pub
trait
MedalObject
<
T
:
MedalConnection
>
{
...
...
src/db_conn_postgres.rs
View file @
8a4af9c7
...
@@ -778,6 +778,8 @@ impl MedalConnection for Connection {
...
@@ -778,6 +778,8 @@ impl MedalConnection for Connection {
}
}
Some
(
group
)
Some
(
group
)
}
}
fn
reset_all_contest_visibilities
(
&
self
)
{
self
.execute
(
"UPDATE contest SET public = ?1"
,
&
[
&
false
])
.unwrap
();
}
}
}
impl
MedalObject
<
Connection
>
for
Task
{
impl
MedalObject
<
Connection
>
for
Task
{
...
...
src/db_conn_sqlite.rs
View file @
8a4af9c7
...
@@ -762,6 +762,8 @@ impl MedalConnection for Connection {
...
@@ -762,6 +762,8 @@ impl MedalConnection for Connection {
}
}
Some
(
group
)
Some
(
group
)
}
}
fn
reset_all_contest_visibilities
(
&
self
)
{
self
.execute
(
"UPDATE contest SET public = ?1"
,
&
[
&
false
])
.unwrap
();
}
}
}
impl
MedalObject
<
Connection
>
for
Task
{
impl
MedalObject
<
Connection
>
for
Task
{
...
...
src/main.rs
View file @
8a4af9c7
...
@@ -95,6 +95,7 @@ fn refresh_all_contests<C>(conn: &mut C)
...
@@ -95,6 +95,7 @@ fn refresh_all_contests<C>(conn: &mut C)
where
C
:
MedalConnection
,
where
C
:
MedalConnection
,
db_objects
::
Contest
:
db_conn
::
MedalObject
<
C
>
db_objects
::
Contest
:
db_conn
::
MedalObject
<
C
>
{
{
conn
.reset_all_contest_visibilities
();
let
v
=
get_all_contest_info
(
"tasks/"
);
let
v
=
get_all_contest_info
(
"tasks/"
);
for
mut
contest_info
in
v
{
for
mut
contest_info
in
v
{
...
...
tasks/contest1.yaml
deleted
100644 → 0
View file @
01a1be83
name
:
"
JwInf
2018
Runde
1"
participation_start
:
"
2009-01-01T12:00:00+01:00"
participation_end
:
"
2009-01-01T12:00:00+01:00"
duration_minutes
:
45
public_listing
:
true
tasks
:
"
Aufgabe
1"
:
"
blub"
"
Aufgabe
7"
:
[
"
blub2"
,
"
blub2/"
,
"
blub2/index.html"
]
"
Aufgabe
3"
:
"
blub/"
:
{
stars
:
1
}
"
blub/index.html"
:
{
stars
:
3
}
"
task3"
:
{
stars
:
5
}
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