fix
This commit is contained in:
parent
ad97a36c60
commit
d038923726
2 changed files with 11 additions and 5 deletions
|
@ -174,6 +174,11 @@ impl VikunjaAPI {
|
|||
serde_json::from_str(&resp).unwrap()
|
||||
}
|
||||
|
||||
pub fn get_project(&self, project: &ProjectID) -> Project {
|
||||
let resp = self.get_request(&format!("/projects/{}", project.0));
|
||||
serde_json::from_str(&resp).unwrap()
|
||||
}
|
||||
|
||||
// labels
|
||||
pub fn get_all_labels(&self) -> Vec<Label> {
|
||||
get_all_items(|x| {
|
||||
|
|
|
@ -16,10 +16,7 @@ fn print_task_oneline(task: &Task, projects: &[Project]) {
|
|||
|
||||
print_color(crossterm::style::Color::Blue, &task.title);
|
||||
|
||||
let project = projects
|
||||
.into_iter()
|
||||
.find(|x| x.id == task.project_id)
|
||||
.unwrap();
|
||||
let project = projects.iter().find(|x| x.id == task.project_id).unwrap();
|
||||
print_color(
|
||||
hex_to_color(&project.hex_color).unwrap_or(crossterm::style::Color::Reset),
|
||||
&format!(" [{}]", project.title),
|
||||
|
@ -47,7 +44,11 @@ pub fn print_current_tasks(
|
|||
project: Option<&String>,
|
||||
label: Option<&String>,
|
||||
) {
|
||||
let current_tasks = api.get_latest_tasks();
|
||||
let current_tasks = if project.is_some() || label.is_some() {
|
||||
api.get_all_tasks()
|
||||
} else {
|
||||
api.get_latest_tasks()
|
||||
};
|
||||
|
||||
let mut selection: Vec<_> = if done {
|
||||
current_tasks
|
||||
|
|
Loading…
Reference in a new issue