From 70b02881ff1867b1a3446a68e77d5ac23272ca7f Mon Sep 17 00:00:00 2001 From: Hanmin Park Date: Wed, 10 May 2023 13:01:46 +0200 Subject: [PATCH] =?UTF-8?q?Fixed=20for=20holidays,=20only=20had=201=20holi?= =?UTF-8?q?day=20for=20May=20=E2=9C=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- inc/scholarship_logtime.h | 4 +++- src/logtime/print_logtime.c | 12 ++++++------ src/parse_data/parse_api.c | 8 ++++++-- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/inc/scholarship_logtime.h b/inc/scholarship_logtime.h index 6456dfd..947e70b 100644 --- a/inc/scholarship_logtime.h +++ b/inc/scholarship_logtime.h @@ -6,7 +6,7 @@ /* By: hanmpark +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2022/11/22 13:56:48 by hanmpark #+# #+# */ -/* Updated: 2023/03/14 01:16:49 by hanmpark ### ########.fr */ +/* Updated: 2023/04/03 14:39:43 by hanmpark ### ########.fr */ /* */ /* ************************************************************************** */ @@ -18,6 +18,8 @@ # define HOLIDAYS 1 # define DATES 0 +# define INFO_BONUS 1 + typedef struct s_data { char **chosen; diff --git a/src/logtime/print_logtime.c b/src/logtime/print_logtime.c index bd97abb..5c0ce15 100644 --- a/src/logtime/print_logtime.c +++ b/src/logtime/print_logtime.c @@ -6,7 +6,7 @@ /* By: hanmpark +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2022/12/16 17:20:10 by hanmpark #+# #+# */ -/* Updated: 2023/03/14 01:24:47 by hanmpark ### ########.fr */ +/* Updated: 2023/04/03 14:43:10 by hanmpark ### ########.fr */ /* */ /* ************************************************************************** */ @@ -116,10 +116,10 @@ static void print_progressbar(int tthours, int hours) static void print_info(t_data *data) { - int *stdlog; - int *bnlog; - int *ttlog; - int tthours; + int *stdlog; + int *bnlog; + int *ttlog; + int tthours; stdlog = ccl_addlog(data->chosen); bnlog = ccl_addlog(data->bonus); @@ -137,7 +137,7 @@ static void print_info(t_data *data) void print_result(t_data *data) { - int i; + int i; i = 0; if (data->chosen && data->show_dates == 1) diff --git a/src/parse_data/parse_api.c b/src/parse_data/parse_api.c index ee93b49..38bb14e 100644 --- a/src/parse_data/parse_api.c +++ b/src/parse_data/parse_api.c @@ -6,7 +6,7 @@ /* By: hanmpark +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2022/12/18 19:13:07 by hanmpark #+# #+# */ -/* Updated: 2023/03/14 01:21:02 by hanmpark ### ########.fr */ +/* Updated: 2023/05/10 11:58:17 by hanmpark ### ########.fr */ /* */ /* ************************************************************************** */ @@ -14,6 +14,7 @@ #include "get_next_line.h" #include "find_time.h" #include "parse.h" +#include "print.h" static void write_holidays(char **tab, int year, int i, int fd) { @@ -36,7 +37,10 @@ static void sort_holidays(char **tab, int fd) i = 0; while (tab[i] && atoi(tab[i] + 2) != current_year()) i++; - while (tab[i] && atoi(tab[i] + 7) < current_month()) + while (tab[i] && atoi(tab[i] + 7) < current_month()) { + i++; + } + while (tab[i] && atoi(tab[i + 1] + 7) == current_month()) i++; write_holidays(tab, current_year(), i, fd); while (tab[i] && atoi(tab[i] + 2) != current_year() - 1)