Compare commits

...

9 Commits

Author SHA1 Message Date
ketrptr 1f54110aa5 Merge branch 'bugfix' of https://gitea.fhgr.ch/schurtisimon/StudyPlanner into bugfix 2024-12-16 10:50:39 +01:00
ketrptr 60cfa51406 modified: src/ui.c 2024-12-16 10:50:02 +01:00
Jan Wild 8d6d6b2870
Buffer reset gelöscht 2024-12-16 10:45:45 +01:00
Jan Wild 5f65a91ffb
Buffer reset gelöscht 2024-12-16 10:42:46 +01:00
Jan Wild 14705844d7
Buffer reset gelöscht 2024-12-16 10:41:51 +01:00
Jan Wild 2d0bd1341b
Buffer reset eingefügt 2024-12-16 10:40:08 +01:00
Jan Wild 6f3cd456f4
uint zu unsigned int 2024-12-16 10:32:42 +01:00
ketrptr 3b8bd5dc40 Merge branch 'master' of https://gitea.fhgr.ch/schurtisimon/StudyPlanner
modified:   src/llist.c
	modified:   src/planner.c
	modified:   src/planner.h
	modified:   src/ui.c
2024-12-16 10:23:14 +01:00
ketrptr d7cf85b44f modified: src/ui.c 2024-12-16 09:56:58 +01:00
4 changed files with 24 additions and 8 deletions

View File

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

View File

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

View File

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

View File

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