Skip to content

Commit

Permalink
Address Issue #1504; NW Cider Cup Update 1
Browse files Browse the repository at this point in the history
  • Loading branch information
geoffhumphrey committed Feb 14, 2024
1 parent 6b80f0d commit c7982e1
Show file tree
Hide file tree
Showing 20 changed files with 687 additions and 283 deletions.
42 changes: 25 additions & 17 deletions admin/entries.admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -169,26 +169,32 @@
if ($scoresheet_entry) $scoresheet_file_name_1 = $scoresheet_file_name_entry;
if ($scoresheet_judging) $scoresheet_file_name_2 = $scoresheet_file_name_judging;

if ((!empty($row_log['brewInfo'])) || (!empty($row_log['brewMead1'])) || (!empty($row_log['brewMead2'])) || (!empty($row_log['brewMead3']))) {

$brewInfo = "";
//$brewInfo .= "Required Info: ";
if (!empty($row_log['brewInfo'])) $brewInfo .= str_replace("^", " | ", $row_log['brewInfo']);
if (!empty($row_log['brewMead1'])) $brewInfo .= "  ".$row_log['brewMead1'];
if (!empty($row_log['brewMead2'])) $brewInfo .= "  ".$row_log['brewMead2'];
if (!empty($row_log['brewMead3'])) $brewInfo .= "  ".$row_log['brewMead3'];

if (($_SESSION['prefsStyleSet'] == "BJCP2021") && ($row_log['brewCategorySort'] == "02") && ($row_log['brewSubCategory'] == "A")) $required_info .= "<p><strong>Regional Var:</strong> ".$brewInfo."</p>";
else $required_info .= "<p><strong>Req. Info:</strong> ".$brewInfo."</p>";

// Required Info
$brewInfo = "";
if (!empty($row_log['brewInfo'])) {
if (($_SESSION['prefsStyleSet'] == "BJCP2021") && ($row_log['brewCategorySort'] == "02") && ($row_log['brewSubCategory'] == "A")) $brewInfo .= "<li><strong>".$label_regional_variation.":</strong> ".str_replace("^", " | ", $row_log['brewInfo'])."</li>";
else $brewInfo .= "<li><strong>".$label_required_info.":</strong> ".str_replace("^", " | ", $row_log['brewInfo'])."</li>";
}

if (!empty($brewInfo)) $required_info .= $brewInfo;

// Optional Info (Brewer's Specifics)
if (!empty($row_log['brewInfoOptional'])) {
$required_info .= "<p><strong>Op. Info:</strong> ".$row_log['brewInfoOptional']."</p>";
$required_info .= "<li><strong>".$label_optional_info.":</strong> ".$row_log['brewInfoOptional']."</li>";
}

// Required Info for Cider / Mead (Strength, Carb, Sweetness)
$cider_mead_req_info = "";
if (!empty($row_log['brewMead1'])) $cider_mead_req_info .= "<li><strong>".$label_carbonation.":</strong> ".$row_log['brewMead1']."</li>";
if (!empty($row_log['brewMead2'])) $cider_mead_req_info .= "<li><strong>".$label_sweetness.":</strong> ".$row_log['brewMead2']."</li>";
if (!empty($row_log['brewSweetnessLevel'])) $cider_mead_req_info .= "<li><strong>".$label_sweetness_level.":</strong> ".$row_log['brewSweetnessLevel']."</li>";
if (!empty($row_log['brewMead3'])) $cider_mead_req_info .= "<li><strong>".$label_strength.":</strong> ".$row_log['brewMead3']."</li>";

if (!empty($cider_mead_req_info)) $required_info .= $cider_mead_req_info;

// Allergens
if ($entry_allergens) {
$entry_allergens_display .= "<br><strong class=\"text-danger small\">".$label_possible_allergens.": ".$row_log['brewPossAllergens']."</strong>";
$entry_allergens_display .= "<p><strong class=\"text-danger small\">".$label_possible_allergens.": ".$row_log['brewPossAllergens']."</strong></p>";
$entry_allergen_row = "bg-warning";
}

Expand Down Expand Up @@ -491,7 +497,9 @@
$tbody_rows .= "<div class=\"visible-xs visible-sm hidden-print\" style=\"margin: 5px 0 5px 0\"><button class=\"btn btn-primary btn-block btn-xs\" type=\"button\" data-toggle=\"collapse\" data-target=\"#collapseEntryInfo".$row_log['id']."\" aria-expanded=\"false\" aria-controls=\"collapseEntryInfo".$row_log['id']."\">Entry Info <span class=\"fa fa-lg fa-info-circle\"></span></button></div>";

$tbody_rows .= "<div class=\"collapse small alert alert-info\" style=\"margin-top:5px;margin-bottom:5px;\" id=\"collapseEntryInfo".$row_log['id']."\">";
$tbody_rows .= "<ul class='list-unstyled'>";
$tbody_rows .= $required_info;
$tbody_rows .= "</ul>";
$tbody_rows .= "</div>";
}

Expand Down Expand Up @@ -914,16 +922,16 @@
<th nowrap>Entry</th>
<th nowrap>Judging <?php if (($action != "print") && ($dbTable == "default") && ($_SESSION['userAdminObfuscate'] == 0)) { ?><a href="#" tabindex="0" role="button" data-toggle="popover" data-trigger="hover" data-placement="auto top" data-container="body" title="Judging Numbers" data-content="Judging numbers are random six-digit numbers that are automatically assigned by the system. You can override each judging number when scanning in barcodes, QR Codes, or by entering it in the field provided. Judging numbers must be six characters and cannot include the ^ character. The ^ character will be converted to a dash (-) upon submit. Use leading zeroes (e.g., 000123 or 01-001, etc.). Alpha characters will be converted to lower case for consistency and system use."><span class="<?php echo $hidden_md; ?> hidden-print fa fa-question-circle"></span></a><?php } ?></th>
<th class="<?php echo $hidden_md; ?>">Name</th>
<th>Style</th>
<th>Style <a href="#" tabindex="0" role="button" data-toggle="popover" data-trigger="hover" data-placement="auto top" data-container="body" data-html="true" title="Judging Numbers" data-content="If there is a <span class='fa fa-info-circle'></span> icon next to the style name, the entrant provided required and/or optional information about their entry. Select the icon to review the information."><span class="<?php echo $hidden_md; ?> hidden-print fa fa-question-circle"></span></a></th>
<th class="<?php echo $hidden_sm; ?>"><?php if ($pro_edition == 1) echo "Organization"; else echo "Brewer"; ?></th>
<?php if ($pro_edition == 0) { ?>
<th class="<?php echo $hidden_md; ?> hidden-print">Club</th>
<?php } ?>
<th class="<?php echo $hidden_md; ?> hidden-print">Updated</th>
<th class="<?php echo $hidden_sm; ?>" width="3%">P<span class="hidden-md">aid?</span></th>
<th class="<?php echo $hidden_sm; ?>" width="3%">R<span class="hidden-md">ec'd?</span></th>
<th class="<?php echo $hidden_md; ?> ">Admin Notes <?php if (($action != "print") && ($dbTable == "default")) { ?><a href="#" tabindex="0" role="button" data-toggle="popover" data-trigger="hover" data-placement="auto top" data-container="body" title="Admin Notes" data-content="Catch-all for any information Admins may need for individual entries such as 'partial refund needed', 'maybe mis-categorized', etc. 255 character limit."><span class="<?php echo $hidden_md; ?> hidden-print fa fa-question-circle"></span></a><?php } ?></th>
<th class="<?php echo $hidden_md; ?> ">Staff Notes <?php if (($action != "print") && ($dbTable == "default")) { ?><a href="#" tabindex="0" role="button" data-toggle="popover" data-trigger="hover" data-placement="auto top" data-container="body" title="Staff Notes" data-content="Catch-all for any information staff may need to know about individual entries such as 'single 750ml bottle', 'missing MBOS bottle', etc. Notes entered here are printed on pullsheets. 255 character limit."><span class="<?php echo $hidden_md; ?> hidden-print fa fa-question-circle"></span></a><?php } ?></th>
<th class="<?php echo $hidden_md; ?> ">Admin Notes <?php if (($action != "print") && ($dbTable == "default")) { ?><a href="#" tabindex="0" role="button" data-toggle="popover" data-trigger="hover" data-placement="auto top" data-container="body" data-html="true" title="Admin Notes" data-content="Catch-all for any information Admins may need for individual entries such as &quot;received damaged,&quot; &quot;maybe mis-categorized,&quot; etc. 255 character limit."><span class="<?php echo $hidden_md; ?> hidden-print fa fa-question-circle"></span></a><?php } ?></th>
<th class="<?php echo $hidden_md; ?> ">Staff Notes <?php if (($action != "print") && ($dbTable == "default")) { ?><a href="#" tabindex="0" role="button" data-toggle="popover" data-trigger="hover" data-placement="auto top" data-container="body" data-html="true" title="Staff Notes" data-content="Catch-all for any information staff may need to know about individual entries such as &quot;single 750ml bottle,&quot; &quot;missing MBOS bottle,&quot; etc. Notes entered here are printed on pullsheets. 255 character limit."><span class="<?php echo $hidden_md; ?> hidden-print fa fa-question-circle"></span></a><?php } ?></th>
<th class="<?php echo $hidden_sm; ?>">Loc<span class="hidden-md">/Box</span></th>
<?php if ($action != "print") { ?><th class="hidden-xs hidden-sm hidden-print">Actions</th><?php } ?>
</tr>
Expand Down
8 changes: 5 additions & 3 deletions admin/judging_tables.admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -297,9 +297,11 @@

do {

$bos_modal_body .= "<li>";
$bos_modal_body .= $row_style_type['styleTypeName']." (".bos_method($row_style_type['styleTypeBOSMethod'])." from each table to BOS).";
$bos_modal_body .= "</li>";
if (isset($row_style_type['styleTypeName'])) {
$bos_modal_body .= "<li>";
$bos_modal_body .= $row_style_type['styleTypeName']." (".bos_method($row_style_type['styleTypeBOSMethod'])." from each table to BOS).";
$bos_modal_body .= "</li>";
}

} while ($row_style_type = mysqli_fetch_assoc($style_type));

Expand Down
2 changes: 1 addition & 1 deletion classes/fpdf/pdf_label.php
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ class PDF_Label extends FPDF {
'paper-size'=>'letter',
'metric'=>'mm',
'marginLeft'=>5.4,
'marginTop'=>7.3,
'marginTop'=>7.1,
'NX'=>4,
'NY'=>20,
'SpaceX'=>7.14,
Expand Down
92 changes: 82 additions & 10 deletions eval/dashboard.eval.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
* TO DO:
* - Add check to see if all scores have been imported. If so, don't show or disable the import button.
* - Dynamically check at interval to see if entry currently evaluating has score entered by another judge.
* - Add elapsed time display.
* - Check translation items
*
* -----------------------------------------------------------------------------------------
*
Expand Down Expand Up @@ -47,6 +45,7 @@
* - Cider http://dev.bjcp.org/download/bjcp-scoresheet-cstr.pdf/ *** DONE ***
* - Mead http://dev.bjcp.org/download/bjcp-scoresheet-mstr.pdf/ *** DONE ***
* - Beer http://dev.bjcp.org/download/bjcp-scoresheet-bstr.pdf/ *** DONE ***
* - Add elapsed time display. *** DONE ***
*/

$judging_open = FALSE;
Expand Down Expand Up @@ -358,7 +357,7 @@ function count_future($arr,$needle,$diff) {
$score_style_data = score_style_data($value);
$score_style_data = explode("^",$score_style_data);

$query_entries = sprintf("SELECT id, brewBrewerID, brewStyle, brewCategorySort, brewCategory, brewSubCategory, brewInfo, brewJudgingNumber, brewName, brewPossAllergens FROM %s WHERE (brewCategorySort='%s' AND brewSubCategory='%s') AND brewReceived='1'", $prefix."brewing", $score_style_data[0], $score_style_data[1]);
$query_entries = sprintf("SELECT id, brewBrewerID, brewStyle, brewCategorySort, brewCategory, brewSubCategory, brewInfo, brewJudgingNumber, brewName, brewPossAllergens, brewABV, brewJuiceSource, brewSweetnessLevel, brewMead1, brewMead2, brewMead3 FROM %s WHERE (brewCategorySort='%s' AND brewSubCategory='%s') AND brewReceived='1'", $prefix."brewing", $score_style_data[0], $score_style_data[1]);
if ($_SESSION['prefsDisplaySpecial'] == "J") $query_entries .= " ORDER BY brewJudgingNumber ASC;";
else $query_entries .= " ORDER BY id ASC;";
$entries = mysqli_query($connection,$query_entries) or die (mysqli_error($connection));
Expand Down Expand Up @@ -434,14 +433,75 @@ function count_future($arr,$needle,$diff) {
$style_display = $style.": ".$score_style_data[2];

$info_display = "";
$allergen_display = "";
$abv_display = "";
$juice_src_display = "";
$carb_display = "";
$sweetness_display = "";
$sweetness_level_display = "";
$strength_display = "";
$additional_info = 0;

if (!empty($row_entries['brewInfo'])) {
if (($_SESSION['prefsStyleSet'] == "BJCP2021") && ($row_entries['brewCategorySort'] == "02") && ($row_entries['brewSubCategory'] == "A")) $info_display .= $label_regional_variation;
else $info_display .= $label_required_info;
$info_display .= ": ".$row_entries['brewInfo'];
$additional_info++;
if (($_SESSION['prefsStyleSet'] == "BJCP2021") && ($row_entries['brewCategorySort'] == "02") && ($row_entries['brewSubCategory'] == "A")) $info_display .= "<strong>".$label_regional_variation;
else $info_display .= "<strong>".$label_required_info;
$info_display .= ":</strong> ".$row_entries['brewInfo'];
}

$allergen_display = "";
if (!empty($row_entries['brewPossAllergens'])) $allergen_display .= $label_possible_allergens.": ".$row_entries['brewPossAllergens'];
if (!empty($row_entries['brewMead1'])) {
$additional_info++;
$carb_display .= "<strong>".$label_carbonation.":</strong> ".$row_entries['brewMead1'];
}

if (!empty($row_entries['brewMead2'])) {
$additional_info++;
$sweetness_display .= "<strong>".$label_sweetness.":</strong> ".$row_entries['brewMead2'];
}

if (!empty($row_entries['brewSweetnessLevel'])) {
$additional_info++;
$sweetness_level_display .= "<strong>".$label_sweetness_level.":</strong> ".$row_entries['brewSweetnessLevel'];
}

if (!empty($row_entries['brewMead3'])) {
$additional_info++;
$strength_display .= "<strong>".$label_strength.":</strong> ".$row_entries['brewMead3'];
}

if (!empty($row_entries['brewPossAllergens'])) {
$additional_info++;
$allergen_display .= "<strong>".$label_possible_allergens.":</strong> ".$row_entries['brewPossAllergens'];
}

if (!empty($row_entries['brewABV'])) {
$additional_info++;
$abv_display .= "<strong>".$label_abv.":</strong> ".$row_entries['brewABV'];
}

if (($_SESSION['prefsStyleSet'] == "NWCiderCup") && (!empty($row_entries['brewJuiceSource']))) {

$additional_info++;

$juice_src_arr = json_decode($row_entries['brewJuiceSource'],true);
$juice_src_disp = "";

if (is_array($juice_src_arr['juice_src'])) {
$juice_src_disp .= implode(", ",$juice_src_arr['juice_src']);
$juice_src_disp .= ", ";
}

if ((isset($juice_src_arr['juice_src_other'])) && (is_array($juice_src_arr['juice_src_other']))) {
$juice_src_disp .= implode(", ",$juice_src_arr['juice_src_other']);
$juice_src_disp .= ", ";
}

$juice_src_disp = rtrim($juice_src_disp,",");
$juice_src_disp = rtrim($juice_src_disp,", ");

$juice_src_display .= "<strong>".$label_juice_source.":</strong> ".$juice_src_disp;

}

$add_link = $base_url."index.php?section=evaluation&amp;go=scoresheet&amp;action=add&amp;filter=".$tbl_id."&amp;id=".$row_entries['id'];

Expand All @@ -459,8 +519,20 @@ function count_future($arr,$needle,$diff) {
$table_assignment_data .= "<td><a class=\"anchor\" name=\"".$number."\"></a>".$number."</td>";
$table_assignment_data .= "<td class=\"hidden-xs\">";
$table_assignment_data .= $style_display;
if (!empty($info_display)) $table_assignment_data .= "<br><small><em>".str_replace("^",", ",$info_display)."</em></small>";
if (!empty($allergen_display)) $table_assignment_data .= "<br><small><em>".$allergen_display."</em></small>";

if ($additional_info > 0) {
$table_assignment_data .= "<ul class=\"list-unstyled small\">";
if (!empty($info_display)) $table_assignment_data .= "<li><em>".str_replace("^",", ",$info_display)."</em></li>";
if (!empty($carb_display)) $table_assignment_data .= "<li><em>".$carb_display."</em></li>";
if (!empty($sweetness_display)) $table_assignment_data .= "<li><em>".$sweetness_display."</em></li>";
if (!empty($sweetness_level_display)) $table_assignment_data .= "<li><em>".$sweetness_level_display."</em></li>";
if (!empty($allergen_display)) $table_assignment_data .= "<li><em>".$allergen_display."</em></li>";
if (!empty($abv_display)) $table_assignment_data .= "<li><em>".$abv_display."</em></li>";
if (!empty($juice_src_display)) $table_assignment_data .= "<li><em>".$juice_src_display."</em></li>";
if (!empty($strength_display)) $table_assignment_data .= "<li><em>".$strength_display."</em></li>";
$table_assignment_data .= "</ul>";
}

$table_assignment_data .= "</td>";
$table_assignment_data .= "<td>".$notes."</td>";
$table_assignment_data .= "<td>".$eval_place_actions.$actions."</td>";
Expand Down
2 changes: 1 addition & 1 deletion eval/db.eval.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
$eval = mysqli_query($connection,$query_eval) or die (mysqli_error($connection));
$row_eval = mysqli_fetch_assoc($eval);

if ($dbTable == "default") $query_judge = sprintf("SELECT * FROM %s WHERE uid=%s", $prefix."brewer".$archive_suffix, $row_eval['evalJudgeInfo']);
$query_judge = sprintf("SELECT * FROM %s WHERE uid=%s", $prefix."brewer".$archive_suffix, $row_eval['evalJudgeInfo']);
$judge = mysqli_query($connection,$query_judge) or die (mysqli_error($connection));
$row_judge = mysqli_fetch_assoc($judge);

Expand Down
45 changes: 42 additions & 3 deletions eval/scoresheet.eval.php
Original file line number Diff line number Diff line change
Expand Up @@ -407,20 +407,59 @@
$entry_info_html .= "</div>";
}

if (!empty($row_entry_info['brewMead3'])) {
$entry_info_html .= "<div class=\"row bcoem-admin-element\">";
$entry_info_html .= "<div class=\"col col-lg-3 col-md-4 col-sm-4 col-xs-12\"><strong>".$label_strength."</strong></div>";
$entry_info_html .= "<div class=\"col col-lg-9 col-md-8 col-sm-8 col-xs-12\">".$row_entry_info['brewMead3']."</div>";
$entry_info_html .= "</div>";
}

if (!empty($row_entry_info['brewMead2'])) {
$entry_info_html .= "<div class=\"row bcoem-admin-element\">";
$entry_info_html .= "<div class=\"col col-lg-3 col-md-4 col-sm-4 col-xs-12\"><strong>".$label_sweetness."</strong></div>";
$entry_info_html .= "<div class=\"col col-lg-9 col-md-8 col-sm-8 col-xs-12\">".$row_entry_info['brewMead2']."</div>";
$entry_info_html .= "</div>";
}

if (!empty($row_entry_info['brewMead3'])) {
if (($_SESSION['prefsStyleSet'] == "NWCiderCup") && (!empty($row_entry_info['brewSweetnessLevel']))) {
$entry_info_html .= "<div class=\"row bcoem-admin-element\">";
$entry_info_html .= "<div class=\"col col-lg-3 col-md-4 col-sm-4 col-xs-12\"><strong>".$label_strength."</strong></div>";
$entry_info_html .= "<div class=\"col col-lg-9 col-md-8 col-sm-8 col-xs-12\">".$row_entry_info['brewMead3']."</div>";
$entry_info_html .= "<div class=\"col col-lg-3 col-md-4 col-sm-4 col-xs-12\"><strong>".$label_sweetness_level."</strong></div>";
$entry_info_html .= "<div class=\"col col-lg-9 col-md-8 col-sm-8 col-xs-12\">".$row_entry_info['brewSweetnessLevel']."</div>";
$entry_info_html .= "</div>";
}

if (!empty($row_entry_info['brewABV'])) {
$entry_info_html .= "<div class=\"row bcoem-admin-element\">";
$entry_info_html .= "<div class=\"col col-lg-3 col-md-4 col-sm-4 col-xs-12\"><strong>".$label_abv."</strong></div>";
$entry_info_html .= "<div class=\"col col-lg-9 col-md-8 col-sm-8 col-xs-12\">".$row_entry_info['brewABV']."&#37;</div>";
$entry_info_html .= "</div>";
}

if (($_SESSION['prefsStyleSet'] == "NWCiderCup") && (!empty($row_entry_info['brewJuiceSource']))) {

$juice_src_arr = json_decode($row_entry_info['brewJuiceSource'],true);
$juice_src_disp = "";

if (is_array($juice_src_arr['juice_src'])) {
$juice_src_disp .= implode(", ",$juice_src_arr['juice_src']);
$juice_src_disp .= ", ";
}

if ((isset($juice_src_arr['juice_src_other'])) && (is_array($juice_src_arr['juice_src_other']))) {
$juice_src_disp .= implode(", ",$juice_src_arr['juice_src_other']);
$juice_src_disp .= ", ";
}

$juice_src_disp = rtrim($juice_src_disp,",");
$juice_src_disp = rtrim($juice_src_disp,", ");

$entry_info_html .= "<div class=\"row bcoem-admin-element\">";
$entry_info_html .= "<div class=\"col col-lg-3 col-md-4 col-sm-4 col-xs-12\"><strong>".$label_juice_source."</strong></div>";
$entry_info_html .= "<div class=\"col col-lg-9 col-md-8 col-sm-8 col-xs-12\">".$juice_src_disp."</div>";
$entry_info_html .= "</div>";

}

if (!empty($row_entry_info['brewPossAllergens'])) {
$entry_info_html .= "<div class=\"row bcoem-admin-element\">";
$entry_info_html .= "<div class=\"col col-lg-3 col-md-4 col-sm-4 col-xs-12\"><strong>".$label_possible_allergens."</strong></div>";
Expand Down
Loading

0 comments on commit c7982e1

Please sign in to comment.