mirror of
https://github.com/michaeldv/pit.git
synced 2025-12-08 23:53:25 +00:00
Fixed task search, implemented project search
This commit is contained in:
1
src/db.c
1
src/db.c
@@ -79,6 +79,7 @@ void pit_init(char *argv[]) {
|
||||
void pit_info(char *argv[])
|
||||
{
|
||||
pit_db_load();
|
||||
printf("Pit version: %s\n", PIT_VERSION);
|
||||
printf("Pit file name: %s\n", pit_file_name());
|
||||
printf("Created by: %s on %s\n", header->created_by, format_timestamp(header->created_at));
|
||||
printf("Last updated by: %s on %s\n", header->updated_by, format_timestamp(header->updated_at));
|
||||
|
||||
@@ -47,7 +47,7 @@ static void project_log_update(PProject pp, POptions po)
|
||||
sprintf(a.message + strlen(a.message), " %s (", pp->name);
|
||||
}
|
||||
if (po->project.status) {
|
||||
sprintf(a.message + strlen(a.message), "%sstatus: %s)", (empty ? "" : ", "), po->project.status);
|
||||
sprintf(a.message + strlen(a.message), "%sstatus: %s", (empty ? "" : ", "), po->project.status);
|
||||
}
|
||||
strcat(a.message, ")");
|
||||
pit_action(&a);
|
||||
@@ -72,6 +72,9 @@ static void project_list(POptions po)
|
||||
if (projects->number_of_records > 0) {
|
||||
ppager = pit_pager_initialize(PAGER_PROJECT, 0, projects->number_of_records);
|
||||
for_each_project(pp) {
|
||||
if ((po->project.name && !stristr(pp->name, po->project.name)) ||
|
||||
(po->project.status && !stristr(pp->status, po->project.status)))
|
||||
continue;
|
||||
pit_pager_print(ppager, (char *)pp);
|
||||
}
|
||||
pit_pager_flush(ppager);
|
||||
|
||||
18
src/task.c
18
src/task.c
@@ -191,15 +191,15 @@ void pit_task_list(POptions po, PProject pp)
|
||||
if (!pp) pp = (PProject)pit_table_current(projects);
|
||||
|
||||
for_each_task(pt) {
|
||||
if ((pp && pt->project_id != pp->id) ||
|
||||
(po->task.name && !stristr(pt->name, po->task.name)) ||
|
||||
(po->task.status && !stristr(pt->status, po->task.status)) ||
|
||||
(po->task.priority && !stristr(pt->priority, po->task.priority)) ||
|
||||
(po->task.date && pt->date < po->task.date) ||
|
||||
(po->task.date_max && pt->date > po->task.date_max) ||
|
||||
(po->task.time && pt->time < po->task.time) ||
|
||||
(po->task.time_max && pt->time > po->task.time_max))
|
||||
continue;
|
||||
if ((pp && pt->project_id != pp->id) ||
|
||||
(po && ((po->task.name && !stristr(pt->name, po->task.name)) ||
|
||||
(po->task.status && !stristr(pt->status, po->task.status)) ||
|
||||
(po->task.priority && !stristr(pt->priority, po->task.priority)) ||
|
||||
(po->task.date && pt->date < po->task.date) ||
|
||||
(po->task.date_max && pt->date > po->task.date_max) ||
|
||||
(po->task.time && pt->time < po->task.time) ||
|
||||
(po->task.time_max && pt->time > po->task.time_max))
|
||||
)) continue;
|
||||
pit_pager_print(ppager, (char *)pt);
|
||||
}
|
||||
pit_pager_flush(ppager);
|
||||
|
||||
Reference in New Issue
Block a user