Added quick prototype of get_due_date

This commit is contained in:
xavi 2024-09-29 22:12:50 -07:00
parent 49d46e5ddb
commit 4fc0841049
2 changed files with 17 additions and 2 deletions

View File

@ -38,13 +38,22 @@ int init_date(date *d){
struct tm *local = localtime(&rawtime);
d->year = local->tm_year + 1900;
d->month = local->tm_mon;
d->year = local->tm_mday;
d->month = local->tm_mon + 1;
d->day = local->tm_mday;
return 0;
}
int get_due_date(filtered_tasks *task, char* due_date){
date *d = malloc(sizeof(date));
init_date(d);
printf("%d-%d-%d\n", d->month, d->day, d->year);
}
void init_filtered_tasks(filtered_tasks* task){
task->selected_columns = NULL;
task->title = NULL;
@ -391,6 +400,7 @@ int parse_args(int argc, char** argv, filtered_tasks* task){
if ( argc > 3 ){
if ( x_strcmp(argv[1], "update") ){
get_due_date(task, argv[3]);
task->due_date = argv[3];
return 0;
}
@ -400,6 +410,7 @@ int parse_args(int argc, char** argv, filtered_tasks* task){
}
if ( argc > 4 ){
get_due_date(task, argv[4]);
task->due_date = argv[4];
}

View File

@ -41,6 +41,10 @@ int view_all(sqlite3 *db);
// filtered_tasks constructor
void init_filtered_tasks(filtered_tasks* task);
// Due Date stuff
int init_date(date* date);
int get_due_date(filtered_tasks *task, char* due_date);
// sql generators TODO: might be able to boil this down to 1 func
int prepare_sql_update_stmt(sqlite3 *db, sqlite3_stmt** out_stmt, filtered_tasks* task);
int prepare_sql_delete_stmt(sqlite3 *db, sqlite3_stmt** out_stmt, filtered_tasks* task);