Skip to content

Allow multiple teams and groups in clarification destinations #193

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
42 changes: 21 additions & 21 deletions Contest_API.md
Original file line number Diff line number Diff line change
Expand Up @@ -594,8 +594,8 @@ Note that all results returned from endpoints:
Endpoints that return a JSON array must allow filtering on any
property with type ID (except the `id` property) by passing it as a
query argument. For example, clarifications can be filtered on the
recipient by passing `to_team_id=X`. To filter on a `null` value,
pass an empty string, i.e. `to_team_id=`. It must be possible to
recipient by passing `to_team_ids=X,Y`. To filter on a `null` value,
pass an empty string, i.e. `to_team_ids=`. It must be possible to
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This suggests a real change: instead of just requiring filtering on properies with ID type, we would now also require filtering on properties with type array of ID.

That adds a bunch of extra complexity like: if you specify to_team_ids=X,Y, do you want to match entries where to_team_ids is exactly [X,Y], contains either X or Y, has [X,Y] as a subset, or... I don't think we should go there, and simply change this example to something else than clarifications.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The "OR" of all the to_team_ids (or to_group_ds) makes the most sense. eg. "Any of these teams"

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we should go there, and simply change this example to something else than clarifications.

I agree, we should not add the requirement that you allow filtering on any property of type array of ID.

On a related note, when we say "any property with type ID" do we mean to include properties of type ID ?. We should clarify.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Discussed at meeting. We will not introduce filter on arrays as part of this change, but might later.

filter on multiple different properties simultaneously, with the
meaning that all conditions must be met (they are logically `AND`ed).
Note that filtering on any other property, including property with the type
Expand Down Expand Up @@ -1797,19 +1797,19 @@ The following endpoints are associated with clarification messages:

Properties of clarification message objects:

| Name | Type | Description
| :------------- | :------ | :----------
| id | ID | Identifier of the clarification.
| from\_team\_id | ID ? | Identifier of [team](#teams) sending this clarification request, `null` iff a clarification sent by jury.
| to\_team\_id | ID ? | Identifier of the [team](#teams) receiving this reply, `null` iff a reply to all teams or a request sent by a team.
| reply\_to\_id | ID ? | Identifier of clarification this is in response to, otherwise `null`.
| problem\_id | ID ? | Identifier of associated [problem](#problems), `null` iff not associated to a problem.
| text | string | Question or reply text.
| time | TIME | Time of the question/reply.
| contest\_time | RELTIME | Contest time of the question/reply.
| Name | Type | Description
| :------------- | :--------------- | :----------
| id | ID | Identifier of the clarification.
| from\_team\_id | ID ? | Identifier of the [team](#teams) sending this clarification request, `null` iff a clarification is sent by the jury.
| to\_team\_ids | array of ID ? | Identifiers of the [team(s)](#teams) receiving this reply, `null` iff a reply to all teams or a request sent by a team.
| to\_group\_ids | array of ID ? | Identifiers of the [group(s)](#groups) receiving this reply, `null` iff a reply to all teams or a request sent by a team.
| reply\_to\_id | ID ? | Identifier of clarification this is in response to, otherwise `null`.
| problem\_id | ID ? | Identifier of associated [problem](#problems), `null` iff not associated to a problem.
| text | string | Question or reply text.
| time | TIME | Time of the question/reply.
| contest\_time | RELTIME | Contest time of the question/reply.

Note that at least one of `from_team_id` and `to_team_id` has to be
`null`. That is, teams cannot send messages to other teams.
The recipients of a clarification are the union of `to_team_ids` and `to_group_ids`. A clarification is sent to all teams if `from_team_id`, `to_team_ids` and `to_group_ids` are null. Note that if `from_team_id` is not `null`, then both `to_team_ids` and `to_group_ids` must be `null`. That is, teams cannot send messages to other teams or groups.

#### Modifying clarifications

Expand All @@ -1832,12 +1832,12 @@ exceptions:
choose to include or exclude the `problem_id`.
- The `post_clar` capability only has access to `POST`. `id`,
`time`, and `contest_time` must not be provided. When submitting from a
team account, `to_team_id` must not be provided; `from_team_id` may be
team account, `to_team_ids` and `to_group_ids` must not be provided; `from_team_id` may be
provided but then must match the ID of the team associated with the request.
When submitting from a judge account, `from_team_id` must not be provided.
In either case the server will determine an `id` and the current `time` and
`contest_time`.
- The `proxy_clar` capability only has access to `POST`. `id`, `to_team_id`,
- The `proxy_clar` capability only has access to `POST`. `id`, `to_team_ids`, `to_group_ids`,
`time`, and `contest_time` must not be provided. `from_team_id` must be
provided. The server will determine an `id` and the current `time` and
`contest_time`.
Expand All @@ -1849,7 +1849,7 @@ The request must fail with a 4xx error code if any of the following happens:

- A required property is missing.
- A property that must not be provided is provided.
- The supplied problem, from\_team, to\_team, or reply\_to cannot be found or are
- The supplied problem, `from_team`, `to_team_ids`, `to_group_ids`, or `reply_to` cannot be found or are
not visible to the client that's submitting.
- The provided `id` already exists or is otherwise not acceptable.

Expand All @@ -1867,7 +1867,7 @@ Request:
Returned data:

```json
[{"id":"wf2017-1","from_team_id":null,"to_team_id":null,"reply_to_id":null,"problem_id":null,
[{"id":"wf2017-1","from_team_id":null,"to_team_ids":null,"to_group_ids":null,"reply_to_id":null,"problem_id":null,
"text":"Do not touch anything before the contest starts!","time":"2014-06-25T11:59:27.543+01","contest_time":"-0:15:32.457"}
]
```
Expand All @@ -1879,9 +1879,9 @@ Request:
Returned data:

```json
[{"id":"1","from_team_id":"34","to_team_id":null,"reply_to_id":null,"problem_id":null,
[{"id":"1","from_team_id":"34","to_team_ids":null,"to_group_ids":null,"reply_to_id":null,"problem_id":null,
"text":"May I ask a question?","time":"2017-06-25T11:59:27.543+01","contest_time":"1:59:27.543"},
{"id":"2","from_team_id":null,"to_team_id":"34","reply_to_id":"1","problem_id":null,
{"id":"2","from_team_id":null,"to_team_ids":["34"],"reply_to_id":"1","problem_id":null,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be good to have an example where there are multiple team IDs and/or a group ID.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree. Will update.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated an example to include 3 team ids and a group id in a response.

"text":"Yes you may!","time":"2017-06-25T11:59:47.543+01","contest_time":"1:59:47.543"}
]
```
Expand All @@ -1894,7 +1894,7 @@ Returned data:

```json
[{"id":"1","from_team_id":"34","text":"May I ask a question?","time":"2017-06-25T11:59:27.543+01","contest_time":"1:59:27.543"},
{"id":"2","to_team_id":"34","reply_to_id":"1","text":"Yes you may!","time":"2017-06-25T11:59:47.543+01","contest_time":"1:59:47.543"}
{"id":"2","to_team_ids":["34","57","69"],"to_group_ids":["1336"], "reply_to_id":"1","text":"Yes you may!","time":"2017-06-25T11:59:47.543+01","contest_time":"1:59:47.543"}
]
```

Expand Down
2 changes: 1 addition & 1 deletion Contest_Control_System_Requirements.md
Original file line number Diff line number Diff line change
Expand Up @@ -1007,7 +1007,7 @@ The following access restrictions must apply to GETs on the API endpoints:
thawed.
- For clients with the `public` role the `/clarifications` endpoint must only
contain replies from the jury to all teams, that is, messages where both
`from_team_id` and `to_team_id` are `null`. For clients with the `team` role
`from_team_id`, `to_team_ids` and `to_group_ids` are `null`. For clients with the `team` role
the `/clarifications` endpoint must only contain their own clarifications
(sent or received) and public clarifications.
- For clients with the `public` role the `/awards` and `/scoreboard` endpoints
Expand Down