🐛 Fixed is_some() issues

This commit is contained in:
Maddie H 2023-02-25 00:22:23 +00:00
parent 70760e1aa3
commit 109dbdabbb
No known key found for this signature in database
GPG Key ID: 64FAA9959751687D
2 changed files with 9 additions and 11 deletions

View File

@ -14,16 +14,6 @@ fn parse_tags(tags: Option<String>) -> Option<Vec<String>> {
pub fn show(tasks: &mut Tasks, id: Option<usize>) -> Result<(), TasksError> {
// If no id is given, print out all tasks
if let Some(..) = id {
if tasks.is_empty() {
// Output when no tasks are available
output::info(String::from("no tasks found"))
} else {
// Generate the table of all tasks
let table = tables::tasks_table(tasks);
// Print the table
println!("{}", table);
};
} else {
// Get the task the user wants to see
let id = id.unwrap();
let task = tasks.get_task(id)?;
@ -32,6 +22,14 @@ pub fn show(tasks: &mut Tasks, id: Option<usize>) -> Result<(), TasksError> {
let table = tables::task_table(task, id);
// Print the table
println!("{}", table);
} else if tasks.is_empty() {
// Output when no tasks are available
output::info(String::from("no tasks found"))
} else {
// Generate the table of all tasks
let table = tables::tasks_table(tasks);
// Print the table
println!("{}", table);
};
// Success

View File

@ -103,7 +103,7 @@ impl Task {
}
pub fn stop(&mut self) {
if self.when.is_none() {
if self.when.is_some() {
self.status = Status::Inbox;
} else {
self.status = Status::Pending;