Compare commits

..

No commits in common. "1f54110aa5c350b87a251347a9a3e446b3e13f74" and "ca261158c6f64f80565547cd4cc8a7794828f8c3" have entirely different histories.

4 changed files with 8 additions and 24 deletions

View File

@ -74,7 +74,6 @@ llist *write_csv_to_llist(const char *filename) {
char *taskdeadline_dateSTR = strtok(NULL, ","); char *taskdeadline_dateSTR = strtok(NULL, ",");
char *taskprioritySTR = strtok(NULL, ","); char *taskprioritySTR = strtok(NULL, ",");
char *taskspareSTR = strtok(NULL, ","); char *taskspareSTR = strtok(NULL, ",");
printf(" Der Name des Task ist %s\n",taskname);
// convert char in integer and date // convert char in integer and date
unsigned long int taskcreation_date = unsigned long int taskcreation_date =
@ -101,4 +100,3 @@ llist *write_csv_to_llist(const char *filename) {
} }
return list; // null on error return list; // null on error
} }

View File

@ -226,7 +226,7 @@ llist *genPlan(llist *head, time_t timeAvail) {
0); // use elem with wighest priority 0); // use elem with wighest priority
} }
llistAppend(events_ll, c); llistAppend(events_ll, c);
printEvent(c); // printEvent(c);
// printEvent((Event *)((events_ll)->next)->data); // printEvent((Event *)((events_ll)->next)->data);
// decrement priority of first elem and resort list // decrement priority of first elem and resort list
@ -257,9 +257,8 @@ llist *genPlan(llist *head, time_t timeAvail) {
events_ll = events_ll->next; events_ll = events_ll->next;
tmp->next = NULL; tmp->next = NULL;
llistFreeE(tmp); llistFreeE(tmp);
printf("====EVENTSLL:\n");
llistPrintE(events_ll); llistPrintE(events_ll);
printf("====EVENTSLL:\n");
// update prioriteis in original llist // update prioriteis in original llist
for (int i = 0; i < lLen; i++) { for (int i = 0; i < lLen; i++) {
llist *tmp = llistGet(head, sortedPrio + i); llist *tmp = llistGet(head, sortedPrio + i);

View File

@ -77,7 +77,6 @@ Event *newEvent(Task *t, time_t s, time_t e, uint64_t sp);
*/ */
void freeEvent(Event *e); void freeEvent(Event *e);
void llistFreeE(llist *head); void llistFreeE(llist *head);
void llistPrintE(llist *head);
int cmpEvent(const void *a, const void *b); int cmpEvent(const void *a, const void *b);
/* /*
* takes llist of tasks and returns llist of events * takes llist of tasks and returns llist of events

View File

@ -11,7 +11,6 @@
#include <assert.h> #include <assert.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h>
#include <time.h> #include <time.h>
#ifdef _WIN32 #ifdef _WIN32
@ -21,11 +20,11 @@
const char *dbName = "db.csv"; const char *dbName = "db.csv";
int main(void) { int main(void) {
char taskname[256]; // taskName Buffer
int taskcreation_date = 0; int taskcreation_date = 0;
int taskdeadline_date = 0; int taskdeadline_date = 0;
int taskpriority = 0; int taskpriority = 0;
int taskspare = 0; int taskspare = 0;
char *taskname = NULL; // taskName Buffer
llist *listT = NULL; llist *listT = NULL;
llist *listE = NULL; llist *listE = NULL;
@ -46,20 +45,14 @@ int main(void) {
continue; continue;
}; };
taskname = NULL;
size_t nameLen;
size_t nnread;
switch (choice) { switch (choice) {
case 1: case 1:
printf(" Geben sie das gewünschte Fach ein: \n"); printf(" Geben sie das gewuenschte Fach ein: \n");
time_t now = time(NULL); time_t now = time(NULL);
struct tm lc; struct tm lc;
localtime_r(&now, &lc); localtime_r(&now, &lc);
fgetc(stdin); if (fscanf(stdin, "%s", taskname) <= 0) {
nnread = getline(&taskname, &nameLen, stdin); printf("Ungueltige Eingabe für den Namen.\n");
taskname[nnread - 1] = '\0';
if (nnread < 0) {
printf("Ungültige Eingabe für den Namen.\n");
return -1; return -1;
} }
@ -98,11 +91,7 @@ int main(void) {
scanf("%d", &taskspare); scanf("%d", &taskspare);
// if list exists use it to generate plan // if list exists use it to generate plan
if (listT != NULL) { if (listT != NULL) {
struct tm lc; listE = genPlan(listT, taskspare);
localtime_r(&now, &lc);
lc.tm_hour += taskspare;
time_t avail = mktime(&lc);
listE = genPlan(listT, avail);
write_linkedlist_to_csv(listT, dbName); write_linkedlist_to_csv(listT, dbName);
} else { } else {
printf("list is empty!"); printf("list is empty!");
@ -152,7 +141,6 @@ int main(void) {
"eingeben!\n"); "eingeben!\n");
break; break;
} }
llistPrintE(listE);
exportiCal(listE); exportiCal(listE);
// printf( // printf(
// "Geben Sie die zur verfuegung stehende Zeit für die Fächer an: // "Geben Sie die zur verfuegung stehende Zeit für die Fächer an: