Skip to content

Commit

Permalink
Merge pull request #378 from blackav/377-support-group-merge-mode-for…
Browse files Browse the repository at this point in the history
…-polygon-import

377 support group merge mode for polygon import
  • Loading branch information
blackav authored Nov 2, 2024
2 parents df3b904 + 378ede7 commit c1e036f
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 1 deletion.
3 changes: 3 additions & 0 deletions bin/ej-polygon.c
Original file line number Diff line number Diff line change
Expand Up @@ -3552,6 +3552,9 @@ process_polygon_zip(
if (full_user_score > 0) {
prob_cfg->full_user_score = full_user_score;
}
if (pkt->enable_group_merge > 0) {
prob_cfg->enable_group_merge = 1;
}

cfg_file = open_memstream(&cfg_text, &cfg_size);
problem_config_section_unparse_cfg(cfg_file, prob_cfg);
Expand Down
2 changes: 2 additions & 0 deletions csp/super-server/import_contest_from_polygon_page.csp
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@

<tr><td class="b0">Use RSS memory limit instead of VM:</td><td class="b0"><s:checkbox name="enable_rss_limit" value="1" checkedExpr="enable_rss_limit" /></td></tr>

<tr><td class="b0">Enable test group merging:</td><td class="b0"><s:checkbox name="enable_group_merge" value="1" /></td></tr>

<tr><td class="b0">Verbose importer output:</td><td class="b0"><input type="checkbox" name="verbose" value="1" /></td></tr>

<tr><td class="b0"><s:submit ac="import-from-polygon-action" label="Import" /></td></tr>
Expand Down
2 changes: 2 additions & 0 deletions csp/super-server/import_from_polygon_page.csp
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@

<tr><td class="b0">Use RSS memory limit instead of VM:</td><td class="b0"><s:checkbox name="enable_rss_limit" value="1" checkedExpr="enable_rss_limit" /></td></tr>

<tr><td class="b0">Enable test group merging:</td><td class="b0"><s:checkbox name="enable_group_merge" value="1" /></td></tr>

<tr><td class="b0">Verbose importer output:</td><td class="b0"><input type="checkbox" name="verbose" value="1" /></td></tr>

<tr><td class="b0"><s:submit ac="import-from-polygon-action" label="Import" /></td></tr>
Expand Down
1 change: 1 addition & 0 deletions csp/super-server/update_from_polygon_page.csp
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
<tr><td class="b0">Tests are binary data:</td><td class="b0"><input type="checkbox" name="binary_input" value="1" /></td></tr>
<tr><td class="b0">Embed statement in IFRAME:</td><td class="b0"><input type="checkbox" name="enable_iframe_statement" value="1" checked="checked" /></td></tr>
<tr><td class="b0">Use RSS memory limit instead of VM:</td><td class="b0"><s:checkbox name="enable_rss_limit" value="1" checkedExpr="enable_rss_limit" /></td></tr>
<tr><td class="b0">Enable test group merging:</td><td class="b0"><s:checkbox name="enable_group_merge" value="1" /></td></tr>
<tr><td class="b0">Verbose importer output:</td><td class="b0"><input type="checkbox" name="verbose" value="1" /></td></tr>
<tr><td class="b0"><s:submit ac="update-from-polygon-action" label="Update" /></td></tr>
</table>
Expand Down
2 changes: 2 additions & 0 deletions gen/polygon_packet_meta.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ static struct meta_info_item meta_info_polygon_packet_data[] =
[META_POLYGON_PACKET_verbose] = { META_POLYGON_PACKET_verbose, 'B', XSIZE(struct polygon_packet, verbose), "verbose", XOFFSET(struct polygon_packet, verbose) },
[META_POLYGON_PACKET_ignore_main_solution] = { META_POLYGON_PACKET_ignore_main_solution, 'B', XSIZE(struct polygon_packet, ignore_main_solution), "ignore_main_solution", XOFFSET(struct polygon_packet, ignore_main_solution) },
[META_POLYGON_PACKET_enable_rss_limit] = { META_POLYGON_PACKET_enable_rss_limit, 'B', XSIZE(struct polygon_packet, enable_rss_limit), "enable_rss_limit", XOFFSET(struct polygon_packet, enable_rss_limit) },
[META_POLYGON_PACKET_enable_group_merge] = { META_POLYGON_PACKET_enable_group_merge, 'B', XSIZE(struct polygon_packet, enable_group_merge), "enable_group_merge", XOFFSET(struct polygon_packet, enable_group_merge) },
[META_POLYGON_PACKET_polygon_url] = { META_POLYGON_PACKET_polygon_url, 's', XSIZE(struct polygon_packet, polygon_url), "polygon_url", XOFFSET(struct polygon_packet, polygon_url) },
[META_POLYGON_PACKET_login] = { META_POLYGON_PACKET_login, 's', XSIZE(struct polygon_packet, login), "login", XOFFSET(struct polygon_packet, login) },
[META_POLYGON_PACKET_password] = { META_POLYGON_PACKET_password, 's', XSIZE(struct polygon_packet, password), "password", XOFFSET(struct polygon_packet, password) },
Expand Down Expand Up @@ -106,6 +107,7 @@ void meta_polygon_packet_copy(struct polygon_packet *dst, const struct polygon_p
dst->verbose = src->verbose;
dst->ignore_main_solution = src->ignore_main_solution;
dst->enable_rss_limit = src->enable_rss_limit;
dst->enable_group_merge = src->enable_group_merge;
if (src->polygon_url) {
dst->polygon_url = strdup(src->polygon_url);
}
Expand Down
1 change: 1 addition & 0 deletions include/ejudge/meta/polygon_packet_meta.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ enum
META_POLYGON_PACKET_verbose,
META_POLYGON_PACKET_ignore_main_solution,
META_POLYGON_PACKET_enable_rss_limit,
META_POLYGON_PACKET_enable_group_merge,
META_POLYGON_PACKET_polygon_url,
META_POLYGON_PACKET_login,
META_POLYGON_PACKET_password,
Expand Down
1 change: 1 addition & 0 deletions include/ejudge/polygon_packet.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ struct polygon_packet
ejintbool_t verbose;
ejintbool_t ignore_main_solution;
ejintbool_t enable_rss_limit;
ejintbool_t enable_group_merge;

unsigned char *polygon_url;
unsigned char *login;
Expand Down
8 changes: 7 additions & 1 deletion lib/super_html_6.c
Original file line number Diff line number Diff line change
Expand Up @@ -4483,6 +4483,7 @@ super_serve_op_IMPORT_FROM_POLYGON_ACTION(
int verbose_flag = 0;
int ignore_main_solution_flag = 0;
int enable_rss_limit_flag = 0;
int enable_group_merge_flag = 0;

if (!ss->edited_cnts || !ss->global) {
FAIL(SSERV_ERR_NO_EDITED_CNTS);
Expand Down Expand Up @@ -4640,6 +4641,7 @@ super_serve_op_IMPORT_FROM_POLYGON_ACTION(
if (hr_cgi_param(phr, "binary_input", &s) > 0) binary_input_flag = 1;
if (hr_cgi_param(phr, "enable_iframe_statement", &s) > 0) enable_iframe_statement_flag = 1;
if (hr_cgi_param(phr, "enable_rss_limit", &s) > 0) enable_rss_limit_flag = 1;
if (hr_cgi_param(phr, "enable_group_merge", &s) > 0) enable_group_merge_flag = 1;

if (hr_cgi_param(phr, "language_priority", &s) > 0 && *s) {
if (!strcmp(s, "ru,en")
Expand Down Expand Up @@ -4732,6 +4734,7 @@ super_serve_op_IMPORT_FROM_POLYGON_ACTION(
pp->binary_input = binary_input_flag;
pp->enable_iframe_statement = enable_iframe_statement_flag;
pp->enable_rss_limit = enable_rss_limit_flag;
pp->enable_group_merge = enable_group_merge_flag;
pp->verbose = verbose_flag;
pp->create_mode = 1;
if (upload_mode <= 0) {
Expand Down Expand Up @@ -5318,6 +5321,7 @@ super_serve_op_UPDATE_FROM_POLYGON_ACTION(
int binary_input_flag = 0;
int enable_iframe_statement_flag = 0;
int enable_rss_limit_flag = 0;
int enable_group_merge_flag = 0;

if (hr_cgi_param(phr, "verbose", &s) > 0) verbose_flag = 1;

Expand Down Expand Up @@ -5424,7 +5428,8 @@ super_serve_op_UPDATE_FROM_POLYGON_ACTION(
if (hr_cgi_param(phr, "fetch_latest_available", &s) > 0) fetch_latest_available_flag = 1;
if (hr_cgi_param(phr, "binary_input", &s) > 0) binary_input_flag = 1;
if (hr_cgi_param(phr, "enable_iframe_statement", &s) > 0) enable_iframe_statement_flag = 1;
if (hr_cgi_param(phr, "enable_rss_limit_flag", &s) > 0) enable_rss_limit_flag = 1;
if (hr_cgi_param(phr, "enable_rss_limit", &s) > 0) enable_rss_limit_flag = 1;
if (hr_cgi_param(phr, "enable_group_merge", &s) > 0) enable_group_merge_flag = 1;

if ((r = hr_cgi_param(phr, "polygon_url", &s)) < 0) {
fprintf(log_f, "polygon url is invalid\n");
Expand Down Expand Up @@ -5511,6 +5516,7 @@ super_serve_op_UPDATE_FROM_POLYGON_ACTION(
pp->binary_input = binary_input_flag;
pp->enable_iframe_statement = enable_iframe_statement_flag;
pp->enable_rss_limit = enable_rss_limit_flag;
pp->enable_group_merge = enable_group_merge_flag;
XCALLOC(pp->id, polygon_count + 1);
for (int prob_id = 1, ind = 0; prob_id < ss->prob_a; ++prob_id) {
const struct section_problem_data *prob = ss->probs[prob_id];
Expand Down

0 comments on commit c1e036f

Please sign in to comment.