Compare commits
No commits in common. "61232b70fc47295b758bef482377c2599a7a54be" and "674329dfee554ddd653eee3b725e7898c8e5f225" have entirely different histories.
61232b70fc
...
674329dfee
2 changed files with 2 additions and 40 deletions
|
|
@ -129,19 +129,6 @@ fn handle_command(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(issue_done_time) = issue.done_time {
|
|
||||||
if let Some(start_done_time) = filter.start_done_time {
|
|
||||||
if start_done_time > issue_done_time {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if let Some(end_done_time) = filter.end_done_time {
|
|
||||||
if end_done_time < issue_done_time {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// This issue passed all the filters, include it in list.
|
// This issue passed all the filters, include it in list.
|
||||||
uuids_by_state
|
uuids_by_state
|
||||||
.entry(issue.state.clone())
|
.entry(issue.state.clone())
|
||||||
|
|
|
||||||
29
src/lib.rs
29
src/lib.rs
|
|
@ -1,10 +1,10 @@
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
|
||||||
pub mod comment;
|
pub mod comment;
|
||||||
pub mod database;
|
|
||||||
pub mod git;
|
pub mod git;
|
||||||
pub mod issue;
|
pub mod issue;
|
||||||
pub mod issues;
|
pub mod issues;
|
||||||
|
pub mod database;
|
||||||
|
|
||||||
#[derive(Debug, thiserror::Error)]
|
#[derive(Debug, thiserror::Error)]
|
||||||
pub enum ParseFilterError {
|
pub enum ParseFilterError {
|
||||||
|
|
@ -12,8 +12,6 @@ pub enum ParseFilterError {
|
||||||
ParseError,
|
ParseError,
|
||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
IssueParseError(#[from] crate::issue::IssueError),
|
IssueParseError(#[from] crate::issue::IssueError),
|
||||||
#[error(transparent)]
|
|
||||||
ChronoParseError(#[from] chrono::format::ParseError),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: It's easy to imagine a full dsl for filtering issues, for now
|
// FIXME: It's easy to imagine a full dsl for filtering issues, for now
|
||||||
|
|
@ -25,8 +23,6 @@ pub struct Filter<'a> {
|
||||||
pub include_assignees: std::collections::HashSet<&'a str>,
|
pub include_assignees: std::collections::HashSet<&'a str>,
|
||||||
pub include_tags: std::collections::HashSet<&'a str>,
|
pub include_tags: std::collections::HashSet<&'a str>,
|
||||||
pub exclude_tags: std::collections::HashSet<&'a str>,
|
pub exclude_tags: std::collections::HashSet<&'a str>,
|
||||||
pub start_done_time: Option<chrono::DateTime<chrono::Local>>,
|
|
||||||
pub end_done_time: Option<chrono::DateTime<chrono::Local>>,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Filter<'a> {
|
impl<'a> Filter<'a> {
|
||||||
|
|
@ -42,11 +38,9 @@ impl<'a> Filter<'a> {
|
||||||
include_assignees: std::collections::HashSet::<&'a str>::new(),
|
include_assignees: std::collections::HashSet::<&'a str>::new(),
|
||||||
include_tags: std::collections::HashSet::<&'a str>::new(),
|
include_tags: std::collections::HashSet::<&'a str>::new(),
|
||||||
exclude_tags: std::collections::HashSet::<&'a str>::new(),
|
exclude_tags: std::collections::HashSet::<&'a str>::new(),
|
||||||
start_done_time: None,
|
|
||||||
end_done_time: None,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
for filter_chunk_str in filter_str.split(" ") {
|
for filter_chunk_str in filter_str.split(":") {
|
||||||
let tokens: Vec<&str> = filter_chunk_str.split("=").collect();
|
let tokens: Vec<&str> = filter_chunk_str.split("=").collect();
|
||||||
if tokens.len() != 2 {
|
if tokens.len() != 2 {
|
||||||
return Err(ParseFilterError::ParseError);
|
return Err(ParseFilterError::ParseError);
|
||||||
|
|
@ -82,25 +76,6 @@ impl<'a> Filter<'a> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
"done-time" => {
|
|
||||||
let times: Vec<&str> = tokens[1].split("..").collect();
|
|
||||||
if times.len() > 2 {
|
|
||||||
return Err(ParseFilterError::ParseError);
|
|
||||||
}
|
|
||||||
if times[0].len() != 0 {
|
|
||||||
f.start_done_time = Some(
|
|
||||||
chrono::DateTime::parse_from_rfc3339(times[0])?
|
|
||||||
.with_timezone(&chrono::Local),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
if times[1].len() != 0 {
|
|
||||||
f.end_done_time = Some(
|
|
||||||
chrono::DateTime::parse_from_rfc3339(times[1])?
|
|
||||||
.with_timezone(&chrono::Local),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
_ => {
|
_ => {
|
||||||
println!("unknown filter chunk '{}'", filter_chunk_str);
|
println!("unknown filter chunk '{}'", filter_chunk_str);
|
||||||
return Err(ParseFilterError::ParseError);
|
return Err(ParseFilterError::ParseError);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue