diff --git a/csp/contests/unpriv_main_info.csp b/csp/contests/unpriv_main_info.csp
index 1b79f5e9d..6331b5e37 100644
--- a/csp/contests/unpriv_main_info.csp
+++ b/csp/contests/unpriv_main_info.csp
@@ -1,4 +1,19 @@
<%
+ int enable_user_finish = 0;
+ if (global->is_virtual > 0) {
+ enable_user_finish = 1;
+ } else {
+ if (duration > 0) {
+ enable_user_finish = 1;
+ if (cnts->disable_user_finish > 0) {
+ enable_user_finish = 0;
+ }
+ } else {
+ if (cnts->enable_user_finish > 0) {
+ enable_user_finish = 1;
+ }
+ }
+ }
if (!cnts->exam_mode) {
%>
Server status
<%
@@ -267,7 +282,7 @@ $(function() {
%>
<%
}
%><%
- } else if (!cnts->exam_mode && global->is_virtual <= 0 && start_time > 0 && stop_time <= 0) {
+ } else if (!cnts->exam_mode && global->is_virtual <= 0 && start_time > 0 && stop_time <= 0 && enable_user_finish > 0) {
%>
<%
if (cnts->exam_mode) {
diff --git a/gen/contests_meta.c b/gen/contests_meta.c
index c05d29547..fec2c6529 100644
--- a/gen/contests_meta.c
+++ b/gen/contests_meta.c
@@ -46,6 +46,8 @@ static struct meta_info_item meta_info_contest_desc_data[] =
[CNTS_disable_standalone_reg] = { CNTS_disable_standalone_reg, 'b', XSIZE(struct contest_desc, disable_standalone_reg), "disable_standalone_reg", XOFFSET(struct contest_desc, disable_standalone_reg) },
[CNTS_enable_telegram_registration] = { CNTS_enable_telegram_registration, 'b', XSIZE(struct contest_desc, enable_telegram_registration), "enable_telegram_registration", XOFFSET(struct contest_desc, enable_telegram_registration) },
[CNTS_enable_special_flow] = { CNTS_enable_special_flow, 'b', XSIZE(struct contest_desc, enable_special_flow), "enable_special_flow", XOFFSET(struct contest_desc, enable_special_flow) },
+ [CNTS_enable_user_finish] = { CNTS_enable_user_finish, 'b', XSIZE(struct contest_desc, enable_user_finish), "enable_user_finish", XOFFSET(struct contest_desc, enable_user_finish) },
+ [CNTS_disable_user_finish] = { CNTS_disable_user_finish, 'b', XSIZE(struct contest_desc, disable_user_finish), "disable_user_finish", XOFFSET(struct contest_desc, disable_user_finish) },
[CNTS_reg_deadline] = { CNTS_reg_deadline, 't', XSIZE(struct contest_desc, reg_deadline), "reg_deadline", XOFFSET(struct contest_desc, reg_deadline) },
[CNTS_sched_time] = { CNTS_sched_time, 't', XSIZE(struct contest_desc, sched_time), "sched_time", XOFFSET(struct contest_desc, sched_time) },
[CNTS_open_time] = { CNTS_open_time, 't', XSIZE(struct contest_desc, open_time), "open_time", XOFFSET(struct contest_desc, open_time) },
@@ -212,6 +214,8 @@ void contest_desc_copy(struct contest_desc *dst, const struct contest_desc *src)
dst->disable_standalone_reg = src->disable_standalone_reg;
dst->enable_telegram_registration = src->enable_telegram_registration;
dst->enable_special_flow = src->enable_special_flow;
+ dst->enable_user_finish = src->enable_user_finish;
+ dst->disable_user_finish = src->disable_user_finish;
dst->reg_deadline = src->reg_deadline;
dst->sched_time = src->sched_time;
dst->open_time = src->open_time;
diff --git a/include/ejudge/contests.h b/include/ejudge/contests.h
index 6133a446b..8ef364ee5 100644
--- a/include/ejudge/contests.h
+++ b/include/ejudge/contests.h
@@ -196,6 +196,8 @@ enum
CONTEST_A_DISABLE_STANDALONE_REG,
CONTEST_A_ENABLE_TELEGRAM_REGISTRATION,
CONTEST_A_ENABLE_SPECIAL_FLOW,
+ CONTEST_A_ENABLE_USER_FINISH,
+ CONTEST_A_DISABLE_USER_FINISH,
CONTEST_LAST_ATTR
};
@@ -349,6 +351,8 @@ struct contest_desc
ejbytebool_t disable_standalone_reg;
ejbytebool_t enable_telegram_registration;
ejbytebool_t enable_special_flow;
+ ejbytebool_t enable_user_finish;
+ ejbytebool_t disable_user_finish;
time_t reg_deadline;
time_t sched_time;
diff --git a/include/ejudge/meta/contests_meta.h b/include/ejudge/meta/contests_meta.h
index ca7447574..30e3802c5 100644
--- a/include/ejudge/meta/contests_meta.h
+++ b/include/ejudge/meta/contests_meta.h
@@ -39,6 +39,8 @@ enum
CNTS_disable_standalone_reg,
CNTS_enable_telegram_registration,
CNTS_enable_special_flow,
+ CNTS_enable_user_finish,
+ CNTS_disable_user_finish,
CNTS_reg_deadline,
CNTS_sched_time,
CNTS_open_time,
diff --git a/lib/contests.c b/lib/contests.c
index 7af19ac46..22525d7d7 100644
--- a/lib/contests.c
+++ b/lib/contests.c
@@ -184,6 +184,8 @@ const int contests_attr_to_meta_map[CONTEST_LAST_ATTR] =
[CONTEST_A_DISABLE_STANDALONE_REG] = CNTS_disable_standalone_reg,
[CONTEST_A_ENABLE_TELEGRAM_REGISTRATION] = CNTS_enable_telegram_registration,
[CONTEST_A_ENABLE_SPECIAL_FLOW] = CNTS_enable_special_flow,
+ [CONTEST_A_ENABLE_USER_FINISH] = CNTS_enable_user_finish,
+ [CONTEST_A_DISABLE_USER_FINISH] = CNTS_disable_user_finish,
};
char const * const contests_elem_map[] =
@@ -345,6 +347,8 @@ char const * const contests_attr_map[] =
"disable_standalone_reg",
"enable_telegram_registration",
"enable_special_flow",
+ "enable_user_finish",
+ "disable_user_finish",
0
};
@@ -889,6 +893,8 @@ static const unsigned char contest_bool_attr_set[CONTEST_LAST_ATTR] =
[CONTEST_A_DISABLE_STANDALONE_REG] = 1,
[CONTEST_A_ENABLE_TELEGRAM_REGISTRATION] = 1,
[CONTEST_A_ENABLE_SPECIAL_FLOW] = 1,
+ [CONTEST_A_ENABLE_USER_FINISH] = 1,
+ [CONTEST_A_DISABLE_USER_FINISH] = 1,
};
static void
diff --git a/lib/contests_2.c b/lib/contests_2.c
index 4158fcab1..d2b34b0e8 100644
--- a/lib/contests_2.c
+++ b/lib/contests_2.c
@@ -78,6 +78,7 @@ contests_write_header(
CONTEST_A_MANAGED, CONTEST_A_RUN_MANAGED, CONTEST_A_OLD_RUN_MANAGED, CONTEST_A_READY, CONTEST_A_READ_ONLY_NAME,
CONTEST_A_ENABLE_OAUTH, CONTEST_A_ENABLE_REMINDERS,
CONTEST_A_DISABLE_STANDALONE_REG, CONTEST_A_ENABLE_TELEGRAM_REGISTRATION, CONTEST_A_ENABLE_SPECIAL_FLOW,
+ CONTEST_A_ENABLE_USER_FINISH, CONTEST_A_DISABLE_USER_FINISH,
0
};
for (i = 0; flist[i]; ++i) {