From c6f61dcd07b8a1ef86fd340b198f1ffa65be52a9 Mon Sep 17 00:00:00 2001 From: S-YUN Date: Thu, 20 Jun 2024 00:51:55 +0900 Subject: [PATCH 1/5] =?UTF-8?q?fix:=20=EC=9B=94=20=EB=8B=A8=EC=9C=84?= =?UTF-8?q?=EB=8A=94=20MM?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/dart_debug_sample.dart | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/lib/dart_debug_sample.dart b/lib/dart_debug_sample.dart index 5472e58..4da04fe 100644 --- a/lib/dart_debug_sample.dart +++ b/lib/dart_debug_sample.dart @@ -1,16 +1,14 @@ import 'package:intl/intl.dart'; class YukymController { - // DateTime.parse(_userData.value!.selectDate) - String nowDate = DateFormat('yyyy-mm-dd').format(DateTime.now()); + String nowDate = DateFormat('yyyy-MM-dd').format(DateTime.now()); late String nowTime; // 1. 자시의 국 : 갑자1국 = getTyOne()의 값 String getTyA() { - List timeDataOne = - _getTimeDataOne(nowDate); + List timeDataOne = _getTimeDataOne(nowDate); if (timeDataOne.isNotEmpty) { nowTime = timeDataOne.first.ty1; @@ -32,13 +30,12 @@ class YukymController { return nowTime; } else { // Handle the case when the list is empty - return '경오7국'; // Or any other appropriate action + return '경오7국'; // Or any other appropriate action } } String getTyB() { - List timeDataOne = - _getTimeDataOne(nowDate); + List timeDataOne = _getTimeDataOne(nowDate); String result = timeDataOne.first.ty12; final nowTime = DateTime.now(); @@ -89,4 +86,4 @@ class YukymTimeModel { String ty10 = '갑자10국'; String ty11 = '갑자11국'; String ty12 = '갑자12국'; -} \ No newline at end of file +} From b6d7bd3d381ac8de028797a657f6dfc4418d7e5f Mon Sep 17 00:00:00 2001 From: S-YUN Date: Thu, 20 Jun 2024 01:00:06 +0900 Subject: [PATCH 2/5] =?UTF-8?q?fix:=20=20&&=20=EC=97=B0=EC=82=B0=EC=9E=90?= =?UTF-8?q?=EB=A5=BC=20=EC=82=AC=EC=9A=A9=ED=95=98=EC=97=AC=20=EC=8B=9C?= =?UTF-8?q?=EA=B0=84=20=EB=B2=94=EC=9C=84=EB=A5=BC=20=EC=A0=95=ED=99=95?= =?UTF-8?q?=ED=9E=88=20=EB=B9=84=EA=B5=90,=20=EB=B9=A0=ED=8A=B8=EB=A6=B0?= =?UTF-8?q?=20=EA=B2=83=EC=9C=BC=EB=A1=9C=20=EC=B6=94=EC=A0=95=EB=90=98?= =?UTF-8?q?=EB=8A=94=20=EC=8B=9C=EA=B0=84=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/dart_debug_sample.dart | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/lib/dart_debug_sample.dart b/lib/dart_debug_sample.dart index 4da04fe..a96d641 100644 --- a/lib/dart_debug_sample.dart +++ b/lib/dart_debug_sample.dart @@ -39,26 +39,30 @@ class YukymController { String result = timeDataOne.first.ty12; final nowTime = DateTime.now(); - if (nowTime.hour >= 0 || nowTime.hour < 2) { + if (nowTime.hour >= 0 && nowTime.hour < 2) { return timeDataOne.first.ty1; - } else if (nowTime.hour >= 4 || nowTime.hour < 6) { + } else if (nowTime.hour >= 2 && nowTime.hour < 4) { return timeDataOne.first.ty2; - } else if (nowTime.hour >= 6 || nowTime.hour < 8) { + } else if (nowTime.hour >= 4 && nowTime.hour < 6) { return timeDataOne.first.ty3; - } else if (nowTime.hour >= 8 || nowTime.hour < 10) { + } else if (nowTime.hour >= 6 && nowTime.hour < 8) { return timeDataOne.first.ty4; - } else if (nowTime.hour >= 10 || nowTime.hour < 12) { + } else if (nowTime.hour >= 8 && nowTime.hour < 10) { return timeDataOne.first.ty5; - } else if (nowTime.hour >= 12 || nowTime.hour < 14) { + } else if (nowTime.hour >= 10 && nowTime.hour < 12) { return timeDataOne.first.ty6; - } else if (nowTime.hour >= 16 || nowTime.hour < 18) { + } else if (nowTime.hour >= 12 && nowTime.hour < 14) { return timeDataOne.first.ty7; - } else if (nowTime.hour >= 18 || nowTime.hour < 20) { + } else if (nowTime.hour >= 14 && nowTime.hour < 16) { return timeDataOne.first.ty8; - } else if (nowTime.hour >= 20 || nowTime.hour < 22) { + } else if (nowTime.hour >= 16 && nowTime.hour < 18) { return timeDataOne.first.ty9; - } else if (nowTime.hour >= 22 || nowTime.hour < 24) { + } else if (nowTime.hour >= 18 && nowTime.hour < 20) { return timeDataOne.first.ty10; + } else if (nowTime.hour >= 20 && nowTime.hour < 22) { + return timeDataOne.first.ty11; + } else if (nowTime.hour >= 22 && nowTime.hour < 24) { + return timeDataOne.first.ty12; } return result; From 919938adf828a26013ab015a09acef6b33d66f2b Mon Sep 17 00:00:00 2001 From: S-YUN Date: Thu, 20 Jun 2024 10:33:22 +0900 Subject: [PATCH 3/5] =?UTF-8?q?refactor:=20getTyA()=20=EB=A6=AC=ED=8C=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/dart_debug_sample.dart | 36 ++++++++++++------------------------ 1 file changed, 12 insertions(+), 24 deletions(-) diff --git a/lib/dart_debug_sample.dart b/lib/dart_debug_sample.dart index a96d641..2002fa1 100644 --- a/lib/dart_debug_sample.dart +++ b/lib/dart_debug_sample.dart @@ -7,32 +7,20 @@ class YukymController { late String nowTime; // 1. 자시의 국 : 갑자1국 = getTyOne()의 값 - String getTyA() { - List timeDataOne = _getTimeDataOne(nowDate); - - if (timeDataOne.isNotEmpty) { - nowTime = timeDataOne.first.ty1; +String getTyA() { + List timeDataOne = _getTimeDataOne(nowDate); + int month = int.parse(nowDate.substring(5, 7)); - final month = nowDate.substring(5, 7); - if (month == '01' || month == '02') { - return '경오1국'; - } else if (month == '03' || month == '04') { - return '경오2국'; - } else if (month == '05' || month == '06') { - return '경오3국'; - } else if (month == '07' || month == '08') { - return '경오4국'; - } else if (month == '09' || month == '10') { - return '경오5국'; - } else if (month == '11' || month == '12') { - return '경오6국'; - } - return nowTime; - } else { - // Handle the case when the list is empty - return '경오7국'; // Or any other appropriate action - } + if (timeDataOne.isEmpty) { + return '경오7국'; } + if (month < 1 || month > 12) { + return timeDataOne.first.ty1; + } + //month값이 유효하면 index계산 + String index = ((month + 1) ~/ 2).toString(); + return '경오$index국'; +} String getTyB() { List timeDataOne = _getTimeDataOne(nowDate); From deb601c36b5648b026e3f79720d6ebfb291954cf Mon Sep 17 00:00:00 2001 From: S-YUN Date: Thu, 20 Jun 2024 11:03:03 +0900 Subject: [PATCH 4/5] =?UTF-8?q?1.=20getTyA()=EB=8A=94=20=EC=9B=94=20?= =?UTF-8?q?=EA=B0=92=EC=9D=84=20=EA=B8=B0=EC=A4=80=EC=9C=BC=EB=A1=9C=20?= =?UTF-8?q?=EA=B3=84=EC=82=B0,=20getTyB()=EB=8A=94=20=EC=8B=9C=EA=B0=84?= =?UTF-8?q?=EC=9D=84=20=EA=B8=B0=EC=A4=80=EC=9C=BC=EB=A1=9C=20=EA=B3=84?= =?UTF-8?q?=EC=82=B0=ED=95=9C=EB=8B=A4=EA=B3=A0=20=EC=B6=94=EC=A0=95=202.?= =?UTF-8?q?=20YukymTimeModel=EC=9D=B4=20=EC=A3=BC=EC=96=B4=EC=A7=84=20?= =?UTF-8?q?=EC=BD=94=EB=93=9C=EB=A7=8C=20=EB=B4=A4=EC=9D=84=EB=95=8C?= =?UTF-8?q?=EB=8A=94=20=EC=96=B4=EB=96=A4=20=EC=9D=98=EB=AF=B8=EB=A5=BC=20?= =?UTF-8?q?=EA=B0=80=EC=A7=80=EB=8A=94=EC=A7=80=20=EC=95=8C=20=EC=88=98=20?= =?UTF-8?q?=EC=97=86=EC=96=B4=EC=84=9C=20=EC=82=AD=EC=A0=9C=ED=95=B4?= =?UTF-8?q?=EB=B2=84=EB=A6=BC..=203.=20getTyA()=EC=97=90=EC=84=9C=20?= =?UTF-8?q?=EC=9B=94=20=EA=B0=92=EC=9D=80=201~12=20=EC=99=B8=EC=9D=98=20?= =?UTF-8?q?=EB=8B=A4=EB=A5=B8=20=EA=B0=92=EC=9D=B4=20=EC=98=AC=20=EB=95=8C?= =?UTF-8?q?=EB=8A=94=20=EA=B2=BD=EC=98=A4=207=EA=B5=AD=20=EC=9C=BC?= =?UTF-8?q?=EB=A1=9C=20=EB=B0=98=ED=99=98=ED=95=98=EB=8A=94=20=EC=9B=94=20?= =?UTF-8?q?=EC=9C=A0=ED=9A=A8=EC=84=B1=EA=B2=80=EC=82=AC.=204.=20getTyB()?= =?UTF-8?q?=EC=97=90=EC=84=9C=EB=8A=94=20=EC=8B=9C=EA=B0=84=20=EA=B0=92?= =?UTF-8?q?=EC=9D=B4=20=ED=95=AD=EC=83=81=200~24=EB=A5=BC=20=EB=B3=B4?= =?UTF-8?q?=EC=9E=A5=ED=95=98=EB=AF=80=EB=A1=9C=20=EC=9C=A0=ED=9A=A8?= =?UTF-8?q?=EC=84=B1=20=EA=B2=80=EC=82=AC=20=ED=95=84=EC=9A=94=EC=97=86?= =?UTF-8?q?=EB=8B=A4=EA=B3=A0=20=ED=8C=90=EB=8B=A8.=205.=20=EC=82=AC?= =?UTF-8?q?=EC=8B=A4=20=EC=9D=B4=EB=A0=87=EA=B2=8C=20=EB=A7=98=EB=8C=80?= =?UTF-8?q?=EB=A1=9C=20=EB=B0=94=EA=BF=94=EB=8F=84=20=EB=90=98=EB=8A=94?= =?UTF-8?q?=EC=A7=84=20=EB=AA=A8=EB=A5=B4=EA=B2=A0=EC=A7=80=EB=A7=8C=20?= =?UTF-8?q?=EA=B7=B8=EB=83=A5=20=ED=95=B4=EB=B4=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/dart_debug_sample.dart | 80 ++++++-------------------------------- 1 file changed, 12 insertions(+), 68 deletions(-) diff --git a/lib/dart_debug_sample.dart b/lib/dart_debug_sample.dart index 2002fa1..4d90fe3 100644 --- a/lib/dart_debug_sample.dart +++ b/lib/dart_debug_sample.dart @@ -1,81 +1,25 @@ import 'package:intl/intl.dart'; class YukymController { - // DateTime.parse(_userData.value!.selectDate) String nowDate = DateFormat('yyyy-MM-dd').format(DateTime.now()); - late String nowTime; - // 1. 자시의 국 : 갑자1국 = getTyOne()의 값 -String getTyA() { - List timeDataOne = _getTimeDataOne(nowDate); - int month = int.parse(nowDate.substring(5, 7)); + // month를 바탕으로 인덱스 계산 + String getTyA() { + int month = int.parse(nowDate.substring(5, 7)); - if (timeDataOne.isEmpty) { - return '경오7국'; - } - if (month < 1 || month > 12) { - return timeDataOne.first.ty1; + if (month < 1 || month > 12) { + return '경오7국'; + } + String index = ((month + 1) ~/ 2).toString(); + return '경오$index국'; } - //month값이 유효하면 index계산 - String index = ((month + 1) ~/ 2).toString(); - return '경오$index국'; -} String getTyB() { - List timeDataOne = _getTimeDataOne(nowDate); - String result = timeDataOne.first.ty12; - - final nowTime = DateTime.now(); - if (nowTime.hour >= 0 && nowTime.hour < 2) { - return timeDataOne.first.ty1; - } else if (nowTime.hour >= 2 && nowTime.hour < 4) { - return timeDataOne.first.ty2; - } else if (nowTime.hour >= 4 && nowTime.hour < 6) { - return timeDataOne.first.ty3; - } else if (nowTime.hour >= 6 && nowTime.hour < 8) { - return timeDataOne.first.ty4; - } else if (nowTime.hour >= 8 && nowTime.hour < 10) { - return timeDataOne.first.ty5; - } else if (nowTime.hour >= 10 && nowTime.hour < 12) { - return timeDataOne.first.ty6; - } else if (nowTime.hour >= 12 && nowTime.hour < 14) { - return timeDataOne.first.ty7; - } else if (nowTime.hour >= 14 && nowTime.hour < 16) { - return timeDataOne.first.ty8; - } else if (nowTime.hour >= 16 && nowTime.hour < 18) { - return timeDataOne.first.ty9; - } else if (nowTime.hour >= 18 && nowTime.hour < 20) { - return timeDataOne.first.ty10; - } else if (nowTime.hour >= 20 && nowTime.hour < 22) { - return timeDataOne.first.ty11; - } else if (nowTime.hour >= 22 && nowTime.hour < 24) { - return timeDataOne.first.ty12; - } + // 2시간 단위로 인덱스 계산 + int nowHour = DateTime.now().hour; + String index = ((nowHour ~/ 2) + 1).toString(); - return result; + return '갑자$index국'; } - - List _getTimeDataOne(String nowDate) { - List timeDataOne = []; - for (int i = 0; i < 24; i++) { - timeDataOne.add(YukymTimeModel()); - } - return timeDataOne; - } -} - -class YukymTimeModel { - String ty1 = '갑자1국'; - String ty2 = '갑자2국'; - String ty3 = '갑자3국'; - String ty4 = '갑자4국'; - String ty5 = '갑자5국'; - String ty6 = '갑자6국'; - String ty7 = '갑자7국'; - String ty8 = '갑자8국'; - String ty9 = '갑자9국'; - String ty10 = '갑자10국'; - String ty11 = '갑자11국'; - String ty12 = '갑자12국'; } From 3d38814c1a6965bbce740f19eb53edb0e6e98400 Mon Sep 17 00:00:00 2001 From: S-YUN Date: Thu, 20 Jun 2024 14:03:54 +0900 Subject: [PATCH 5/5] =?UTF-8?q?feedback=20=ED=9B=84=20=EB=A6=AC=ED=8C=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/dart_debug_sample.dart | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/lib/dart_debug_sample.dart b/lib/dart_debug_sample.dart index 4d90fe3..fd4123a 100644 --- a/lib/dart_debug_sample.dart +++ b/lib/dart_debug_sample.dart @@ -1,25 +1,14 @@ -import 'package:intl/intl.dart'; - class YukymController { - String nowDate = DateFormat('yyyy-MM-dd').format(DateTime.now()); - // 1. 자시의 국 : 갑자1국 = getTyOne()의 값 // month를 바탕으로 인덱스 계산 String getTyA() { - int month = int.parse(nowDate.substring(5, 7)); - - if (month < 1 || month > 12) { - return '경오7국'; - } - String index = ((month + 1) ~/ 2).toString(); - return '경오$index국'; + int month = DateTime.now().month; + return '경오${((month + 1) ~/ 2).toString()}국'; } + // 2시간 단위로 인덱스 계산 String getTyB() { - // 2시간 단위로 인덱스 계산 int nowHour = DateTime.now().hour; - String index = ((nowHour ~/ 2) + 1).toString(); - - return '갑자$index국'; + return '갑자${((nowHour ~/ 2) + 1).toString()}국'; } }