UI changes, order of stats changed, logic issue
1 parent bf0d661 commit 2cb493a5592aff98592ceae4af6e62a8b3e04c8e
0xRoM authored on 5 Jan 2024
Showing 4 changed files
View
5
habit.php
$dateArray[$date] = 1;
}
}
 
//print_r($dateArray);
 
// Find the longest streak of 0's in dateArray
$currentStreak = 0;
$longestStreak = 0;
 
$longestStreak = max($longestStreak, $currentStreak);
$currentStreak = 0;
}
}
 
// Check for a streak at the end of the array
$longestStreak = max($longestStreak, $currentStreak);
 
return $longestStreak;
}
 
View
16
habit_ui.php
<link rel="stylesheet" href="/deps/jquery-ui.css">
<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>
<body>
if($section['Category'][1] == "-"){
$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) {
$buttonClass = 'button-'.$align;
<div class="'.$align.' habit-title">#'.$section['Activity'].' <div class="habit-timescale">'.$cat.'</div></div>
<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>
';
View
30
habit_ui_style.css
width: -webkit-fill-available;
margin-top: -90px;
margin-right: 90px;
}
.habit-info{
text-align: right;
font-size:1.6em;
}
 
.good{ color: #58e81b;}
.bad{ color: #e81b1b; }
 
.button-good{ background-color: #58e81b; color:#000; }
.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{
padding-top:10px;
View
8
index.php
if($section['Category'][1] == "-"){
$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) {
$buttonClass = 'button-'.$align;
Buy Me A Coffee