Skip to content

Commit

Permalink
Merge pull request #309 from blackav/308-implement-api-for-contest-re…
Browse files Browse the repository at this point in the history
…gistration

308 implement api for contest registration
  • Loading branch information
blackav committed Feb 23, 2024
2 parents 265fb26 + ae1da5e commit 9e34685
Show file tree
Hide file tree
Showing 14 changed files with 764 additions and 185 deletions.
450 changes: 274 additions & 176 deletions gen/new_server_match.c

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions gen/prepare_meta.c
Original file line number Diff line number Diff line change
Expand Up @@ -1378,7 +1378,7 @@ static struct meta_info_item meta_info_section_problem_data_data[] =
[CNTSPROB_unhandled_vars] = { CNTSPROB_unhandled_vars, 's', XSIZE(struct section_problem_data, unhandled_vars), "unhandled_vars", XOFFSET(struct section_problem_data, unhandled_vars) },
[CNTSPROB_score_view] = { CNTSPROB_score_view, 'x', XSIZE(struct section_problem_data, score_view), "score_view", XOFFSET(struct section_problem_data, score_view) },
[CNTSPROB_score_view_score] = { CNTSPROB_score_view_score, '?', XSIZE(struct section_problem_data, score_view_score), NULL, XOFFSET(struct section_problem_data, score_view_score) },
[CNTSPROB_score_view_text] = { CNTSPROB_score_view_text, 'x', XSIZE(struct section_problem_data, score_view_text), "score_view_text", XOFFSET(struct section_problem_data, score_view_text) },
[CNTSPROB_score_view_text] = { CNTSPROB_score_view_text, 'x', XSIZE(struct section_problem_data, score_view_text), NULL, XOFFSET(struct section_problem_data, score_view_text) },
[CNTSPROB_xml_file_path] = { CNTSPROB_xml_file_path, 's', XSIZE(struct section_problem_data, xml_file_path), NULL, XOFFSET(struct section_problem_data, xml_file_path) },
[CNTSPROB_var_xml_file_paths] = { CNTSPROB_var_xml_file_paths, 'x', XSIZE(struct section_problem_data, var_xml_file_paths), NULL, XOFFSET(struct section_problem_data, var_xml_file_paths) },
};
Expand Down Expand Up @@ -1800,7 +1800,7 @@ void cntsprob_copy(struct section_problem_data *dst, const struct section_proble
}
dst->score_view = (typeof(dst->score_view)) sarray_copy((char**) src->score_view);
// private score_view_score
dst->score_view_text = (typeof(dst->score_view_text)) sarray_copy((char**) src->score_view_text);
// private score_view_text
// private xml_file_path
// private var_xml_file_paths
// hidden xml
Expand Down Expand Up @@ -1929,7 +1929,7 @@ void cntsprob_free(struct section_problem_data *ptr)
free(ptr->unhandled_vars);
sarray_free((char**) ptr->score_view);
// private score_view_score
sarray_free((char**) ptr->score_view_text);
// private score_view_text
// private xml_file_path
// private var_xml_file_paths
// hidden xml
Expand Down
6 changes: 6 additions & 0 deletions include/ejudge/json_serializers.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ json_serialize_run(
struct userlist_user;
struct userlist_user_info;
struct userlist_contest;

struct cJSON *
json_serialize_userlist_contest(
int user_id,
const struct userlist_contest *uc);

struct cJSON *
json_serialize_userlist_user(
const struct userlist_user *u,
Expand Down
3 changes: 3 additions & 0 deletions include/ejudge/new_server_proto.h
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,8 @@ enum
NEW_SRV_ACTION_JOB_STATUS_PAGE,
NEW_SRV_ACTION_DOWNLOAD_JOB_RESULT,
NEW_SRV_ACTION_GET_USER,
NEW_SRV_ACTION_COPY_USER_INFO,
NEW_SRV_ACTION_CHANGE_REGISTRATION,

NEW_SRV_ACTION_LAST,
};
Expand Down Expand Up @@ -572,6 +574,7 @@ enum
NEW_SRV_ERR_INV_USERPROB_ID,
NEW_SRV_ERR_INV_EXT_USER,
NEW_SRV_ERR_INV_NOTIFY,
NEW_SRV_ERR_ALREADY_EXISTS,

NEW_SRV_ERR_LAST,
};
Expand Down
2 changes: 1 addition & 1 deletion include/ejudge/prepare.h
Original file line number Diff line number Diff line change
Expand Up @@ -1317,7 +1317,7 @@ struct section_problem_data
/** external score view */
char **score_view;
int *score_view_score META_ATTRIB((meta_private));
char **score_view_text;
char **score_view_text META_ATTRIB((meta_private));

/** full path to xml_file */
unsigned char *xml_file_path META_ATTRIB((meta_private));
Expand Down
5 changes: 4 additions & 1 deletion l10n/ejudge.kk_KZ.UTF-8.po
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: 3.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-02-04 16:05+0300\n"
"POT-Creation-Date: 2024-02-21 22:06+0300\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: Kazakh <[email protected]>\n"
Expand Down Expand Up @@ -426,6 +426,9 @@ msgstr ""
msgid "Allow viewing the judge comment of the valuer"
msgstr ""

msgid "Already exists"
msgstr ""

#, c-format
msgid "An e-mail messages is sent to the address <tt>%s</tt>."
msgstr ""
Expand Down
5 changes: 4 additions & 1 deletion l10n/ejudge.ru_RU.UTF-8.po
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: ejudge 3\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-02-04 16:05+0300\n"
"POT-Creation-Date: 2024-02-21 22:06+0300\n"
"PO-Revision-Date: 2022-01-12 13:17+0300\n"
"Last-Translator: Alexander Chernov <[email protected]>\n"
"Language-Team: Russian <[email protected]>\n"
Expand Down Expand Up @@ -473,6 +473,9 @@ msgid "Allow viewing the judge comment of the valuer"
msgstr ""
"Разрешить просмотр комментария для судей, полученного от программы оценивания"

msgid "Already exists"
msgstr "Уже существует"

#, c-format
msgid "An e-mail messages is sent to the address <tt>%s</tt>."
msgstr ""
Expand Down
5 changes: 4 additions & 1 deletion l10n/ejudge.uk_UA.UTF-8.po
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: 3.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-02-04 16:05+0300\n"
"POT-Creation-Date: 2024-02-21 22:06+0300\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: Ukrainian <[email protected]>\n"
Expand Down Expand Up @@ -426,6 +426,9 @@ msgstr ""
msgid "Allow viewing the judge comment of the valuer"
msgstr ""

msgid "Already exists"
msgstr ""

#, c-format
msgid "An e-mail messages is sent to the address <tt>%s</tt>."
msgstr ""
Expand Down
10 changes: 9 additions & 1 deletion lib/http_request.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* -*- c -*- */

/* Copyright (C) 2014-2021 Alexander Chernov <[email protected]> */
/* Copyright (C) 2014-2024 Alexander Chernov <[email protected]> */

/*
* This program is free software; you can redistribute it and/or modify
Expand Down Expand Up @@ -315,6 +315,14 @@ hr_cgi_param_jsbool_opt(
if (p_val) *p_val = 1;
return 1;
}
if (!strcasecmp(s, "no")) {
if (p_val) *p_val = 0;
return 1;
}
if (!strcasecmp(s, "yes")) {
if (p_val) *p_val = 1;
return 1;
}
errno = 0;
v = strtol(s, &eptr, 10);
if (errno || *eptr) {
Expand Down
2 changes: 2 additions & 0 deletions lib/new_server_at.c
Original file line number Diff line number Diff line change
Expand Up @@ -341,4 +341,6 @@ const unsigned char * const ns_symbolic_action_table[NEW_SRV_ACTION_LAST] =
[NEW_SRV_ACTION_JOB_STATUS_PAGE] = "job-status-page",
[NEW_SRV_ACTION_DOWNLOAD_JOB_RESULT] = "download-job-result",
[NEW_SRV_ACTION_GET_USER] = "get-user",
[NEW_SRV_ACTION_COPY_USER_INFO] = "copy-user-info",
[NEW_SRV_ACTION_CHANGE_REGISTRATION] = "change-registration",
};
Loading

0 comments on commit 9e34685

Please sign in to comment.