Fixed task search, implemented project search

This commit is contained in:
Mike Dvorkin
2010-08-20 20:36:49 -07:00
parent a1b0be3af8
commit 5731d747f3
3 changed files with 14 additions and 10 deletions

View File

@@ -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));

View File

@@ -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);

View File

@@ -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);