style: fix the rustfmt linted files
Some checks failed
actionlint check / actionlint check (pull_request) Successful in 5s
checkov check / checkov check (pull_request) Successful in 52s
conventional commit messages check / conventional commit messages check (pull_request) Successful in 4s
conventional pull request title check / conventional pull request title check (pull_request) Successful in 2s
dotenv-linter check / dotenv-linter check (pull_request) Successful in 5s
GitLeaks check / GitLeaks check (pull_request) Successful in 6s
hadolint check / hadolint check (pull_request) Successful in 7s
htmlhint check / htmlhint check (pull_request) Successful in 9s
markdownlint check / markdownlint check (pull_request) Successful in 9s
Prettier check / Prettier check (pull_request) Successful in 10s
Rust check / Rust check (pull_request) Failing after 6m20s
ShellCheck check / ShellCheck check (pull_request) Successful in 12s
Stylelint check / Stylelint check (pull_request) Successful in 11s
yamllint check / yamllint check (pull_request) Successful in 13s
Some checks failed
actionlint check / actionlint check (pull_request) Successful in 5s
checkov check / checkov check (pull_request) Successful in 52s
conventional commit messages check / conventional commit messages check (pull_request) Successful in 4s
conventional pull request title check / conventional pull request title check (pull_request) Successful in 2s
dotenv-linter check / dotenv-linter check (pull_request) Successful in 5s
GitLeaks check / GitLeaks check (pull_request) Successful in 6s
hadolint check / hadolint check (pull_request) Successful in 7s
htmlhint check / htmlhint check (pull_request) Successful in 9s
markdownlint check / markdownlint check (pull_request) Successful in 9s
Prettier check / Prettier check (pull_request) Successful in 10s
Rust check / Rust check (pull_request) Failing after 6m20s
ShellCheck check / ShellCheck check (pull_request) Successful in 12s
Stylelint check / Stylelint check (pull_request) Successful in 11s
yamllint check / yamllint check (pull_request) Successful in 13s
This commit is contained in:
@ -67,23 +67,39 @@ impl Ord for Task {
|
||||
match (&self.category, &other.category) {
|
||||
(Category::Inbox, Category::Inbox) => self.created_at.cmp(&other.created_at),
|
||||
(
|
||||
Category::Calendar { date: self_date, time: self_time, .. },
|
||||
Category::Calendar { date: other_date, time: other_time, .. }
|
||||
) => self_date.cmp(other_date)
|
||||
.then(ReverseOrdOption::from(
|
||||
&self_time.as_ref().map(|calendar_time| calendar_time.time())
|
||||
).cmp(&ReverseOrdOption::from(
|
||||
&other_time.as_ref().map(|calendar_time| calendar_time.time())
|
||||
)))
|
||||
.then(ReverseOrdOption::from(&self.deadline()).cmp(
|
||||
&ReverseOrdOption::from(&other.deadline())
|
||||
))
|
||||
Category::Calendar {
|
||||
date: self_date,
|
||||
time: self_time,
|
||||
..
|
||||
},
|
||||
Category::Calendar {
|
||||
date: other_date,
|
||||
time: other_time,
|
||||
..
|
||||
},
|
||||
) => self_date
|
||||
.cmp(other_date)
|
||||
.then(
|
||||
ReverseOrdOption::from(
|
||||
&self_time.as_ref().map(|calendar_time| calendar_time.time()),
|
||||
)
|
||||
.cmp(&ReverseOrdOption::from(
|
||||
&other_time
|
||||
.as_ref()
|
||||
.map(|calendar_time| calendar_time.time()),
|
||||
)),
|
||||
)
|
||||
.then(
|
||||
ReverseOrdOption::from(&self.deadline())
|
||||
.cmp(&ReverseOrdOption::from(&other.deadline())),
|
||||
)
|
||||
.then(self.created_at.cmp(&other.created_at)),
|
||||
(Category::Done, Category::Done) | (Category::Trash, Category::Trash) => {
|
||||
self.updated_at.cmp(&other.updated_at).reverse()
|
||||
}
|
||||
(_, _) => ReverseOrdOption::from(&self.deadline())
|
||||
.cmp(&ReverseOrdOption::from(&other.deadline()))
|
||||
.then(self.created_at.cmp(&other.created_at)),
|
||||
(Category::Done, Category::Done) | (Category::Trash, Category::Trash)
|
||||
=> self.updated_at.cmp(&other.updated_at).reverse(),
|
||||
(_, _) => ReverseOrdOption::from(&self.deadline()).cmp(
|
||||
&ReverseOrdOption::from(&other.deadline())
|
||||
).then(self.created_at.cmp(&other.created_at)),
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -125,7 +141,11 @@ impl Ord for TaskWithSubtasks {
|
||||
#[derive(Insertable, Serialize, Deserialize, Validate, Clone, Debug)]
|
||||
#[diesel(table_name = tasks)]
|
||||
pub struct NewTask {
|
||||
#[validate(length(min = "TITLE_LENGTH_MIN", max = "TITLE_LENGTH_MAX", code = "title_length"))]
|
||||
#[validate(length(
|
||||
min = "TITLE_LENGTH_MIN",
|
||||
max = "TITLE_LENGTH_MAX",
|
||||
code = "title_length"
|
||||
))]
|
||||
pub title: String,
|
||||
pub deadline: Option<chrono::NaiveDate>,
|
||||
pub category: Category,
|
||||
@ -139,7 +159,12 @@ impl NewTask {
|
||||
category: Category,
|
||||
project_id: Option<i32>,
|
||||
) -> Self {
|
||||
Self { title, deadline, category, project_id }
|
||||
Self {
|
||||
title,
|
||||
deadline,
|
||||
category,
|
||||
project_id,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user