예제 #1
0
echo "<br>" . $intervalDays . " days selected";
echo "<br> {$dbSum02} days practiced";
echo "<br>You've practiced about " . percentFunc($dbSum02, $intervalDays) . "% of the time during this time interval.";
//interval-avg definitions and function
$intervalAvg = $dbSum / $intervalDays;
function intervalAvg($var, $int, $str)
{
    echo abs(round($var * $int / 60 - 0.5)) . " hr " . $var * $int % 60 . " min {$str} <br>";
}
echo "<h3> AVERAGES FOR THIS INTERVAL: </h3>";
intervalAvg($intervalAvg, 1, "per day");
intervalAvg($intervalAvg, 7, "per week");
intervalAvg($intervalAvg, 30.4375, "per month");
intervalAvg($intervalAvg, 91.25, "per quarter");
intervalAvg($intervalAvg, 365.25, "per year");
intervalAvg($intervalAvg, $intervalDays, "total");
echo round($dbSum / $dbSum02) . " min practiced per active practice day";
function goalDiff($goalHr, $sumHr)
{
    $minDiffRaw = $goalHr - $sumHr;
    echo "<br>" . abs(round($minDiffRaw / 60 - 0.5)) . " hr " . $minDiffRaw % 60 . " min left to go";
}
echo "<h3>GOALS FORECAST:</h3>";
echo abs(round($dbSum03 / 60 - 0.5)) . " hr " . $dbSum03 % 60 . " min practiced since November 2014.";
echo "<br><br><b>Civic Orchestra (~750 hrs)</b>";
echo "<br> Progress: about " . percentFunc($dbSum03, 45000) . "% completed";
goalDiff(45000, $dbSum03);
echo "<br><br><b>Lincoln Symphony Orchestra (~1500 hrs)</b>";
echo "<br> Progress: about " . percentFunc($dbSum03, 90000) . "% completed";
goalDiff(90000, $dbSum03);
echo "<br><br><b>Fancy Orchestra (~7500 hrs)</b>";
예제 #2
0
}
//echo(minPerInterval($minPerDayAvg, 7) . "");
$minPerDayAvg = minPerInterval($minPerDayAvg, 1);
$minPerWeekAvg = minPerInterval($minPerDayAvg, 7);
$minPerMonthAvg = minPerInterval($minPerDayAvg, 30.4375);
$minPerQuarterAvg = minPerInterval($minPerDayAvg, 91.25);
$minPerYearAvg = minPerInterval($minPerDayAvg, 365.25);
function intervalAvg($var, $int, $str)
{
    echo round($var * $int / 60 - 0.5) . " hour(s) " . $var * $int % 60 . " minute(s) per {$str} average <br>";
}
intervalAvg($minPerDayAvg, 1, "day");
intervalAvg($minPerDayAvg, 7, "week");
intervalAvg($minPerDayAvg, 30.4375, "month");
intervalAvg($minPerDayAvg, 91.25, "quarter");
intervalAvg($minPerDayAvg, 365.25, "year");
echo round($minPerDayAvg / 60 - 0.5) . " hour(s) " . $minPerDayAvg % 60 . " minutes per day average <br>";
//this formula should be looped somehow!
//Jimbo talking about how this section could be made to look simpler:
//myMinutesComputer($minPerDayAvg, 'day')
//myMinutesComputer($minPerWeekAvg, 'week')
// -> "0 hour(s) 15.6 minutes per day average <br>"
// -> "1 hour(s) 3.2 minutes per week average <br>"
$minPerWeekAvg = $minPerDayAvg * 7;
echo round($minPerWeekAvg) . " rounded minutes per week average <br>";
echo round($minPerWeekAvg / 60 - 0.5) . " hour(s) " . $minPerWeekAvg % 60 . " minutes per week average <br>";
$minPerMonthAvg = $minPerDayAvg * 30.4375;
//365.25 / 12
echo round($minPerMonthAvg) . " rounded minutes per month average <br>";
$minPerQuarterAvg = $minPerDayAvg * 91.25;
echo round($minPerQuarterAvg) . " rounded minutes per quarter average <br>";