Skip to content

Commit

Permalink
Merge pull request #38 from mrbobdobolina/release/v4.0.3
Browse files Browse the repository at this point in the history
Release/v4.0.3
  • Loading branch information
mrbobdobolina authored Jan 14, 2023
2 parents 319bd84 + b5f60cf commit ae180e4
Show file tree
Hide file tree
Showing 7 changed files with 63 additions and 13 deletions.
2 changes: 1 addition & 1 deletion admin/add-game.php
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@

<div class="col-12 mb-3">
<label class="form-label">Error Spin(s)</label>
<input class="form-control" type="text" name="errors">
<input class="form-control" type="text" name="error_spin">
</div>

<div class="col-12 mb-3">
Expand Down
4 changes: 4 additions & 0 deletions assets/movie-night-stats/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -325,3 +325,7 @@ ul h5{
.poster{
width: 100%;
}

#method-chart.bar {
--labels-size: 150px;
}
1 change: 1 addition & 0 deletions changelog.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

//Array('date' => "", 'version' => '', 'details' => Array("")),
$changes = Array(
Array('date'=>"January 14, 2023", 'version' => 'Version 4.0.3', 'details' => Array("Fixed bug where error spin wasn't added to DB correctly.","Fixed graphical issue where all 12 movies were tied for most requests.","Added viewer chart for spun methods.")),
Array('date'=>"October 27, 2022", 'version' => 'Version 4.0.1', 'details' => Array("Cleanded up redundant code.", "Fixed issue collective movie rating when less than 12 films were present.","We discovered a lost movie night and added data.")),
Array('date'=>"October 23, 2022", 'version' => 'Version 4.0.0', 'details' => Array("Bug fixes.", "Removed unneeded column from viewers page", "fixed issue on the backend", "updated version number", "added really dumb stats","Lots of other stuff probably.")),
Array('date'=>"April 23, 2022", 'version' => 'Version 3.9.0', 'details' => Array("Bug fixes.", "Improvements to viewers and viewer pages.")),
Expand Down
2 changes: 1 addition & 1 deletion common.php
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ function this_db_version(){
}

function echoVersionNumber(){
echo "4.0.1";
echo "4.0.3";
return;
}

Expand Down
9 changes: 9 additions & 0 deletions inc/viewers.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,13 @@ function getViewerName($id){
return getMoviegoerById($id);
}

function count_viewer_spin_methods($pdo, $viewer_id){
$stmt = $pdo->prepare("SELECT selection_method, count(*) FROM week WHERE spinner = ? GROUP BY selection_method ORDER BY count(*) DESC");
$stmt->execute([$viewer_id]);
$result = $stmt->fetchALL();

return $result;

}

?>
28 changes: 28 additions & 0 deletions viewer.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,34 @@
</tbody>
</table>
</div>
<hr >
<li>
<strong>Spun Methods: </strong>
<?php //echo implode(", ", getSpunViewers($viewer)); ?>
</li>

<div class="chart">
<table id="method-chart" class="charts-css bar show-labels show-data-on-hover">
<thead>
<tr>
<th >Method</th>
<th >Count</th>
</tr>
</thead>
<tbody>
<?php $methods = count_viewer_spin_methods($pdo, $viewer);
$m_max = $methods[0]['count(*)']
?>
<?php foreach($methods as $method):?>
<tr>
<th scope="row"> <?php echo $method['selection_method']; ?> </th>
<td style="--size:<?php echo round($method['count(*)']/$m_max,2); ?>;w"><span class="data data_padding"><?php echo $method['count(*)']; ?></span></td>
</tr>
<?php endforeach;?>
</tbody>
</table>
</div>


</ul>
<hr >
Expand Down
30 changes: 19 additions & 11 deletions years.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,17 @@
$yearly_attendance = Array();
$current_year = date('Y');
for($y = 2019; $y <= $current_year; $y++){
$yearly_events[$y] = count_yearly_events($y);
$yearly_time[$y] = calculateYearlyWatchtime($y);
$yearly_attendance[$y] = calculate_attendance($y);
if(count_yearly_events($y) > 0){
$yearly_events[$y] = count_yearly_events($y);
$yearly_time[$y] = calculateYearlyWatchtime($y);
$yearly_attendance[$y] = calculate_attendance($y);
$year_list[] = $y;
}
}
$max_events = max($yearly_events);
$max_time = max($yearly_time);
$max_attendance = max($yearly_attendance);

arsort($year_list);
?>

<!-- top row of charts -->
Expand Down Expand Up @@ -105,7 +108,8 @@
</div>


<?php for($ii = $current_year; $ii >= 2019; $ii--):?>
<?php //for($ii = $current_year; $ii >= 2019; $ii--):?>
<?php foreach($year_list as $ii): ?>
<div class="card p-2 mt-5 mb-3">
<p class="display-6 text-center mt-5 mb-2"> <?php echo $ii; ?> Stats</p>
<div class="row row-cols-1 row-cols-md-2 row-cols-md-2 row-cols-xl-3 g-3 justify-content-center">
Expand Down Expand Up @@ -335,18 +339,22 @@
$winners = count($biggest['top']);
if($winners > 1){
//more than one person one! It's a tie!
$people = Array();
foreach($biggest['top'] as $person){
$people[] = get_movie_by_id($pdo,$person);
if($winners != 12){
$people = Array();
foreach($biggest['top'] as $person){
$people[] = get_movie_by_id($pdo,$person);
}
$message = "It's a ".$winners."-way tie between ".implode(' and ', $people)." with ". $biggest['count']." requests!";
} else {
$message = "(All the films are tied.)";//probably only one movie night for this year
}
$message = "It's a ".$winners."-way tie between ".implode(' and ', $people)." with ". $biggest['count']." requests!";
} elseif($winners == 1) {
$message = get_movie_by_id($pdo,$biggest['top'][0]) ." with ". $biggest['count']." requests!";
} else {
$message = "(no requests yet)";
}
?>
<div class="card align-self-center" style="height:175px;">
<div class="card align-self-center" style="height:175px; overflow:hidden;">
<div class="card-body" >
<p class="bold">Most Requested Films:</p>
<div>
Expand Down Expand Up @@ -512,7 +520,7 @@
</div>

</div>
<?php endfor;?>
<?php endforeach;?>

</div>
</div>
Expand Down

0 comments on commit ae180e4

Please sign in to comment.