Skip to content
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

[Needs review] Feature: @rfcbot poll [teams] #219

Merged
merged 24 commits into from
Aug 16, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
155e428
add itertools as dependency.
Centril Jun 20, 2018
1814249
add database model for Poll stuff.
Centril Jun 20, 2018
dd221a4
really add itertools as dependency in main.rs.
Centril Jun 20, 2018
1e9814b
teams: expose test data, change team names a bit, expose ping and nam…
Centril Jun 20, 2018
c5d769c
refactor a bunch of logic and implement polling (hopefully...).
Centril Jun 20, 2018
60ae53f
update command grammar in README.md.
Centril Jun 20, 2018
cd230f8
fix syntax error in up.sql migration.
Centril Jun 20, 2018
5b69176
fix copy error in up.sql migration.
Centril Jun 20, 2018
fffdbd6
fix typo in up.sql migration.
Centril Jun 20, 2018
97a4b26
close poll when everyone has answered it.
Centril Jun 21, 2018
0de4780
fix #212 by filtering in unstarted fcps. (#223)
Centril Jun 21, 2018
59dc131
Update toolchain and lockfile (#232)
Centril Aug 11, 2018
ea67451
Add Centril to the lang team (#230)
joshtriplett Aug 11, 2018
ef63384
fix typos (quized -> quizzed).
Centril Aug 11, 2018
90de0d2
Merge remote-tracking branch 'upstream/master' into feature/poll-team-2
Centril Aug 11, 2018
7990d27
fix 225, and deal with leading whitespace.
Centril Aug 11, 2018
437d7a2
colocate from_invocation_line and from_str_all.
Centril Aug 11, 2018
4810f33
get rid of global state from command parser.
Centril Aug 11, 2018
9a7a94a
review -> response for polls.
Centril Aug 11, 2018
6fabf31
fix comments.
Centril Aug 11, 2018
b5916fb
make progress on all 3 in evaluate_nags.
Centril Aug 15, 2018
4b5ecc2
RfcBotCommand::{AskQuestion -> StartPoll}.
Centril Aug 15, 2018
5a1d5dd
gracefully handle poll comment typos.
Centril Aug 15, 2018
8e87361
fix bug.
Centril Aug 15, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ toml = "0.4"
url = "1.4"
urlencoded = "0.5"
maplit = "1.0.1"
itertools = "0.7.8"

[dependencies.chrono]
features = ["serde"]
Expand Down
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,25 @@ cancel ::= "cancel | "canceled" | "canceling" | "cancels" ;
review ::= "reviewed" | "review" | "reviewing" | "reviews" ;
concern ::= "concern" | "concerned" | "concerning" | "concerns" ;
resolve ::= "resolve" | "resolved" | "resolving" | "resolves" ;
poll ::= "ask" | "asked" | "asking" | "asks" |
"poll" | "polled" | "polling" | "polls" |
"query" | "queried" | "querying" | "queries" |
"inquire" | "inquired" | "inquiring" | "inquires" |
"quiz" | "quizzed" | "quizzing" | "quizzes" |
"survey" | "surveyed" | "surveying" | "surveys" ;

team_label ::= "T-lang" | .. ;
team_label_simple ::= "lang" | .. ;
team_ping ::= "@"? "rust-lang/lang" | ..;
team_target ::= team_label | team_label_simple | team_ping ;

line_remainder ::= .+$ ;
ws_separated ::= ... ;

subcommand ::= merge | close | postpone | cancel | review
| concern line_remainder
| resolve line_remainder
| poll [team_target]* line_remainder
;

invocation ::= "fcp" subcommand
Expand Down
2 changes: 2 additions & 0 deletions migrations/2018-06-20-062854_create_poll_table/down.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
DROP TABLE poll;
DROP TABLE poll_response_request;
19 changes: 19 additions & 0 deletions migrations/2018-06-20-062854_create_poll_table/up.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
CREATE TABLE poll (
id SERIAL PRIMARY KEY,
fk_issue INTEGER UNIQUE NOT NULL REFERENCES issue (id),
fk_initiator INTEGER NOT NULL REFERENCES githubuser (id),
fk_initiating_comment INTEGER NOT NULL REFERENCES issuecomment (id),
fk_bot_tracking_comment INTEGER NOT NULL REFERENCES issuecomment (id),
poll_question VARCHAR NOT NULL,
poll_created_at TIMESTAMP NOT NULL,
poll_closed BOOLEAN NOT NULL,
poll_teams VARCHAR NOT NULL
);

CREATE TABLE poll_response_request (
id SERIAL PRIMARY KEY,
fk_poll INTEGER NOT NULL REFERENCES poll (id) ON DELETE CASCADE,
fk_respondent INTEGER NOT NULL REFERENCES githubuser (id),
responded BOOLEAN NOT NULL,
UNIQUE (fk_poll, fk_respondent)
);
46 changes: 46 additions & 0 deletions src/domain/rfcbot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,34 @@ use chrono::NaiveDateTime;

use super::schema::*;

#[derive(Clone, Debug, Eq, Ord, Insertable, PartialEq, PartialOrd)]
#[table_name="poll"]
pub struct NewPoll<'a> {
pub fk_issue: i32,
pub fk_initiator: i32,
pub fk_initiating_comment: i32,
pub fk_bot_tracking_comment: i32,
pub poll_question: &'a str,
pub poll_created_at: NaiveDateTime,
pub poll_closed: bool,
pub poll_teams: &'a str,
}

#[derive(AsChangeset, Clone, Debug, Deserialize, Eq, Ord,
PartialEq, PartialOrd, Queryable, Serialize)]
#[table_name="poll"]
pub struct Poll {
pub id: i32,
pub fk_issue: i32,
pub fk_initiator: i32,
pub fk_initiating_comment: i32,
pub fk_bot_tracking_comment: i32,
pub poll_question: String,
pub poll_created_at: NaiveDateTime,
pub poll_closed: bool,
pub poll_teams: String,
}

#[derive(Clone, Debug, Eq, Ord, Insertable, PartialEq, PartialOrd)]
#[table_name="fcp_proposal"]
pub struct NewFcpProposal<'a> {
Expand All @@ -14,6 +42,24 @@ pub struct NewFcpProposal<'a> {
pub fcp_closed: bool,
}

#[derive(Clone, Debug, Eq, Insertable, Ord, PartialEq, PartialOrd, Serialize)]
#[table_name="poll_response_request"]
pub struct NewPollResponseRequest {
pub fk_poll: i32,
pub fk_respondent: i32,
pub responded: bool,
}

#[derive(AsChangeset, Clone, Debug, Deserialize, Eq, Ord,
PartialEq, PartialOrd, Queryable, Serialize)]
#[table_name="poll_response_request"]
pub struct PollResponseRequest {
pub id: i32,
pub fk_poll: i32,
pub fk_respondent: i32,
pub responded: bool,
}

#[derive(AsChangeset, Clone, Debug, Deserialize, Eq, Ord,
PartialEq, PartialOrd, Queryable, Serialize)]
#[table_name="fcp_proposal"]
Expand Down
27 changes: 27 additions & 0 deletions src/domain/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,29 @@ table! {
}
}

table! {
poll (id) {
id -> Int4,
fk_issue -> Int4,
fk_initiator -> Int4,
fk_initiating_comment -> Int4,
fk_bot_tracking_comment -> Int4,
poll_question -> Varchar,
poll_created_at -> Timestamp,
poll_closed -> Bool,
poll_teams -> Varchar,
}
}

table! {
poll_response_request (id) {
id -> Int4,
fk_poll -> Int4,
fk_respondent -> Int4,
responded -> Bool,
}
}

joinable!(fcp_concern -> githubuser (fk_initiator));
joinable!(fcp_concern -> fcp_proposal (fk_proposal));
joinable!(fcp_proposal -> githubuser (fk_initiator));
Expand All @@ -143,3 +166,7 @@ joinable!(pullrequest -> githubuser (fk_assignee));
joinable!(pullrequest -> milestone (fk_milestone));
joinable!(rfc_feedback_request -> issuecomment (fk_feedback_comment));
joinable!(rfc_feedback_request -> issue (fk_issue));
joinable!(poll -> githubuser (fk_initiator));
joinable!(poll -> issue (fk_issue));
joinable!(poll_response_request -> poll (fk_poll));
joinable!(poll_response_request -> githubuser (fk_respondent));
Loading