From 68d0e18bf222ff6256cf8d2c45d27a5e176c35f3 Mon Sep 17 00:00:00 2001 From: Michal Zimniewicz Date: Sat, 27 Jan 2018 16:36:36 +0100 Subject: show handrecord when both scores are present --- tdd-bootstrap.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'tdd-bootstrap.php') diff --git a/tdd-bootstrap.php b/tdd-bootstrap.php index cf62d46..4626f90 100644 --- a/tdd-bootstrap.php +++ b/tdd-bootstrap.php @@ -31,17 +31,19 @@ class Protocol { $header_tr = $header_td1->parent; $tr = @$header_tr->next_sibling(); while($tr) { - $td_score1 = $tr->find('td[class="bdc"]', 0); - $score1 = str_replace(' ', '', $td_score1->innertext); - $td = $tr->find('td/a', 0); $table = trim($td->innertext); $table = str_replace(' ', '', $table); $table = (int)$table; - if($table && array_key_exists($table, $this->deals_by_tables)) { - // if is played on the 1st table - // TODO check both tables of the match - if($score1) { + if($table && array_key_exists($table, $this->deals_by_tables)) { + $contract1 = trim(str_replace(' ', '', $tr->find('td[class="bdc"]', 0)->innertext)); + $tricks1 = trim(str_replace(' ', '', $tr->find('td[class="bdc"]', 3)->innertext)); + $contract2 = trim(str_replace(' ', '', $tr->next_sibling()->find('td[class="bdc"]', 0)->innertext)); + $tricks2 = trim(str_replace(' ', '', $tr->next_sibling()->find('td[class="bdc"]', 3)->innertext)); + + // if is played on both tables of a match + if(($tricks1 || $contract1 == 'ARB') + && ($tricks2 || $contract2 == 'ARB')) { $deal = $this->deals_by_tables[$table]; $insert = "

Stół $table – Rozdanie {$deal->deal_num}

" . $deal->html(); $modified = 1; -- cgit v1.2.3