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()
|
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
|
// labels
|
||||||
pub fn get_all_labels(&self) -> Vec<Label> {
|
pub fn get_all_labels(&self) -> Vec<Label> {
|
||||||
get_all_items(|x| {
|
get_all_items(|x| {
|
||||||
|
|
|
@ -16,10 +16,7 @@ fn print_task_oneline(task: &Task, projects: &[Project]) {
|
||||||
|
|
||||||
print_color(crossterm::style::Color::Blue, &task.title);
|
print_color(crossterm::style::Color::Blue, &task.title);
|
||||||
|
|
||||||
let project = projects
|
let project = projects.iter().find(|x| x.id == task.project_id).unwrap();
|
||||||
.into_iter()
|
|
||||||
.find(|x| x.id == task.project_id)
|
|
||||||
.unwrap();
|
|
||||||
print_color(
|
print_color(
|
||||||
hex_to_color(&project.hex_color).unwrap_or(crossterm::style::Color::Reset),
|
hex_to_color(&project.hex_color).unwrap_or(crossterm::style::Color::Reset),
|
||||||
&format!(" [{}]", project.title),
|
&format!(" [{}]", project.title),
|
||||||
|
@ -47,7 +44,11 @@ pub fn print_current_tasks(
|
||||||
project: Option<&String>,
|
project: Option<&String>,
|
||||||
label: 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 {
|
let mut selection: Vec<_> = if done {
|
||||||
current_tasks
|
current_tasks
|
||||||
|
|
Loading…
Add table
Reference in a new issue