diff --git a/habit.php b/habit.php index d22adf3..4d0d022 100644 --- a/habit.php +++ b/habit.php @@ -691,6 +691,8 @@ } } + //print_r($dateArray); + // Find the longest streak of 0's in dateArray $currentStreak = 0; $longestStreak = 0; @@ -704,6 +706,9 @@ } } + // Check for a streak at the end of the array + $longestStreak = max($longestStreak, $currentStreak); + return $longestStreak; } diff --git a/habit.php b/habit.php index d22adf3..4d0d022 100644 --- a/habit.php +++ b/habit.php @@ -691,6 +691,8 @@ } } + //print_r($dateArray); + // Find the longest streak of 0's in dateArray $currentStreak = 0; $longestStreak = 0; @@ -704,6 +706,9 @@ } } + // Check for a streak at the end of the array + $longestStreak = max($longestStreak, $currentStreak); + return $longestStreak; } diff --git a/habit_ui.php b/habit_ui.php index 3c90ecb..31ecafb 100644 --- a/habit_ui.php +++ b/habit_ui.php @@ -45,7 +45,7 @@ <link rel="stylesheet" href="/deps/fa.css"> <script src="/deps/jquery-1.12.4.js"></script> <script src="/deps/jquery-ui.js"></script> - <link rel="stylesheet" href="habit_ui_style.css" > + <link rel="stylesheet" href="habit_ui_style.css?id=2" > <script src="habit_ui_script.js"></script> </head> @@ -90,11 +90,11 @@ $align = "bad"; $calCol = "#e81b1b"; $title1 = "Streak"; - $title2 = "Top"; - $title3 = "Total"; + $title2 = "Total"; + $title3 = "Top"; $result1 = habit_get_stat_missed($section['Activity'], $moodlog); - $result2 = habit_get_stat_top_missing($section['Activity'], $moodlog); - $result3 = habit_get_stat_year($section['Activity'], $moodlog); + $result2 = habit_get_stat_year($section['Activity'], $moodlog); + $result3 = habit_get_stat_top_missing($section['Activity'], $moodlog); } $todayCheck = habit_check_daily($section['Activity'], $moodlog); if ($todayCheck) { @@ -139,9 +139,9 @@ <div class="habit-desc">'.$section['Description'].'</div> </div> <div class="habit-info"> - <div class="habit-score"><div class="score-title">'.$title1.'</div><div class="result1">'.$result1.'</div></div> - <div class="habit-score"><div class="score-title">'.$title2.'</div><div class="result2">'.$result2.'</div></div> - <div class="habit-score"><div class="score-title">'.$title3.'</div><div class="result3">'.$result3.'</div></div> + <div class="habit-score"><div class="score-title">'.$title1.'</div><div class="score-result result1">'.$result1.'</div></div> + <div class="habit-score"><div class="score-title">'.$title2.'</div><div class="score-result result2">'.$result2.'</div></div> + <div class="habit-score"><div class="score-title">'.$title3.'</div><div class="score-result result3">'.$result3.'</div></div> </div> </div> '; diff --git a/habit.php b/habit.php index d22adf3..4d0d022 100644 --- a/habit.php +++ b/habit.php @@ -691,6 +691,8 @@ } } + //print_r($dateArray); + // Find the longest streak of 0's in dateArray $currentStreak = 0; $longestStreak = 0; @@ -704,6 +706,9 @@ } } + // Check for a streak at the end of the array + $longestStreak = max($longestStreak, $currentStreak); + return $longestStreak; } diff --git a/habit_ui.php b/habit_ui.php index 3c90ecb..31ecafb 100644 --- a/habit_ui.php +++ b/habit_ui.php @@ -45,7 +45,7 @@ <link rel="stylesheet" href="/deps/fa.css"> <script src="/deps/jquery-1.12.4.js"></script> <script src="/deps/jquery-ui.js"></script> - <link rel="stylesheet" href="habit_ui_style.css" > + <link rel="stylesheet" href="habit_ui_style.css?id=2" > <script src="habit_ui_script.js"></script> </head> @@ -90,11 +90,11 @@ $align = "bad"; $calCol = "#e81b1b"; $title1 = "Streak"; - $title2 = "Top"; - $title3 = "Total"; + $title2 = "Total"; + $title3 = "Top"; $result1 = habit_get_stat_missed($section['Activity'], $moodlog); - $result2 = habit_get_stat_top_missing($section['Activity'], $moodlog); - $result3 = habit_get_stat_year($section['Activity'], $moodlog); + $result2 = habit_get_stat_year($section['Activity'], $moodlog); + $result3 = habit_get_stat_top_missing($section['Activity'], $moodlog); } $todayCheck = habit_check_daily($section['Activity'], $moodlog); if ($todayCheck) { @@ -139,9 +139,9 @@ <div class="habit-desc">'.$section['Description'].'</div> </div> <div class="habit-info"> - <div class="habit-score"><div class="score-title">'.$title1.'</div><div class="result1">'.$result1.'</div></div> - <div class="habit-score"><div class="score-title">'.$title2.'</div><div class="result2">'.$result2.'</div></div> - <div class="habit-score"><div class="score-title">'.$title3.'</div><div class="result3">'.$result3.'</div></div> + <div class="habit-score"><div class="score-title">'.$title1.'</div><div class="score-result result1">'.$result1.'</div></div> + <div class="habit-score"><div class="score-title">'.$title2.'</div><div class="score-result result2">'.$result2.'</div></div> + <div class="habit-score"><div class="score-title">'.$title3.'</div><div class="score-result result3">'.$result3.'</div></div> </div> </div> '; diff --git a/habit_ui_style.css b/habit_ui_style.css index 9fbea16..94089ba 100644 --- a/habit_ui_style.css +++ b/habit_ui_style.css @@ -47,10 +47,6 @@ margin-top: -90px; margin-right: 90px; } -.habit-info{ - text-align: right; - font-size:1.6em; -} .good{ color: #58e81b;} .bad{ color: #e81b1b; } @@ -75,14 +71,30 @@ .button-bad{ background-color: #e81b1b; color:#000; } .button-neut{ background-color: #efe23e; color:#000; } -.habit-score{ - width:145px; - display:inline-block; - text-align: center; - font-size: 0.9em; +.habit-info { + text-align: right; + font-size: 1.6em; + display: flex; + justify-content: flex-end; } + +.habit-score { + width: 135px; + display: inline-block; + text-align: center; + font-size: 1.3em; + background-color: #222; + box-sizing: border-box; + margin-right: 0; + margin-left: 0; +} + .score-title{ font-weight:700; + font-size:0.8em; +} +.score-result{ + font-size: 1.5em; } .habit-cal-day, .habit-cal-week{ diff --git a/habit.php b/habit.php index d22adf3..4d0d022 100644 --- a/habit.php +++ b/habit.php @@ -691,6 +691,8 @@ } } + //print_r($dateArray); + // Find the longest streak of 0's in dateArray $currentStreak = 0; $longestStreak = 0; @@ -704,6 +706,9 @@ } } + // Check for a streak at the end of the array + $longestStreak = max($longestStreak, $currentStreak); + return $longestStreak; } diff --git a/habit_ui.php b/habit_ui.php index 3c90ecb..31ecafb 100644 --- a/habit_ui.php +++ b/habit_ui.php @@ -45,7 +45,7 @@ <link rel="stylesheet" href="/deps/fa.css"> <script src="/deps/jquery-1.12.4.js"></script> <script src="/deps/jquery-ui.js"></script> - <link rel="stylesheet" href="habit_ui_style.css" > + <link rel="stylesheet" href="habit_ui_style.css?id=2" > <script src="habit_ui_script.js"></script> </head> @@ -90,11 +90,11 @@ $align = "bad"; $calCol = "#e81b1b"; $title1 = "Streak"; - $title2 = "Top"; - $title3 = "Total"; + $title2 = "Total"; + $title3 = "Top"; $result1 = habit_get_stat_missed($section['Activity'], $moodlog); - $result2 = habit_get_stat_top_missing($section['Activity'], $moodlog); - $result3 = habit_get_stat_year($section['Activity'], $moodlog); + $result2 = habit_get_stat_year($section['Activity'], $moodlog); + $result3 = habit_get_stat_top_missing($section['Activity'], $moodlog); } $todayCheck = habit_check_daily($section['Activity'], $moodlog); if ($todayCheck) { @@ -139,9 +139,9 @@ <div class="habit-desc">'.$section['Description'].'</div> </div> <div class="habit-info"> - <div class="habit-score"><div class="score-title">'.$title1.'</div><div class="result1">'.$result1.'</div></div> - <div class="habit-score"><div class="score-title">'.$title2.'</div><div class="result2">'.$result2.'</div></div> - <div class="habit-score"><div class="score-title">'.$title3.'</div><div class="result3">'.$result3.'</div></div> + <div class="habit-score"><div class="score-title">'.$title1.'</div><div class="score-result result1">'.$result1.'</div></div> + <div class="habit-score"><div class="score-title">'.$title2.'</div><div class="score-result result2">'.$result2.'</div></div> + <div class="habit-score"><div class="score-title">'.$title3.'</div><div class="score-result result3">'.$result3.'</div></div> </div> </div> '; diff --git a/habit_ui_style.css b/habit_ui_style.css index 9fbea16..94089ba 100644 --- a/habit_ui_style.css +++ b/habit_ui_style.css @@ -47,10 +47,6 @@ margin-top: -90px; margin-right: 90px; } -.habit-info{ - text-align: right; - font-size:1.6em; -} .good{ color: #58e81b;} .bad{ color: #e81b1b; } @@ -75,14 +71,30 @@ .button-bad{ background-color: #e81b1b; color:#000; } .button-neut{ background-color: #efe23e; color:#000; } -.habit-score{ - width:145px; - display:inline-block; - text-align: center; - font-size: 0.9em; +.habit-info { + text-align: right; + font-size: 1.6em; + display: flex; + justify-content: flex-end; } + +.habit-score { + width: 135px; + display: inline-block; + text-align: center; + font-size: 1.3em; + background-color: #222; + box-sizing: border-box; + margin-right: 0; + margin-left: 0; +} + .score-title{ font-weight:700; + font-size:0.8em; +} +.score-result{ + font-size: 1.5em; } .habit-cal-day, .habit-cal-week{ diff --git a/index.php b/index.php index b449640..0140716 100755 --- a/index.php +++ b/index.php @@ -699,11 +699,11 @@ $align = "bad"; $calCol = "#e81b1b"; $title1 = "Streak"; - $title2 = "Top"; - $title3 = "Total (Year)"; + $title2 = "Total (Year)"; + $title3 = "Top"; $result1 = habit_get_stat_missed($section['Activity'], $moodlog); - $result2 = habit_get_stat_top_missing($section['Activity'], $moodlog); - $result3 = habit_get_stat_year($section['Activity'], $moodlog); + $result2 = habit_get_stat_year($section['Activity'], $moodlog); + $result3 = habit_get_stat_top_missing($section['Activity'], $moodlog); } $todayCheck = habit_check_daily($section['Activity'], $moodlog); if ($todayCheck) {