Skip to content
This repository has been archived by the owner on Oct 3, 2019. It is now read-only.

Commit

Permalink
refactor: Enabled mess detection (refs #147)
Browse files Browse the repository at this point in the history
  • Loading branch information
literat committed Mar 28, 2018
1 parent 2e16330 commit 828b481
Show file tree
Hide file tree
Showing 17 changed files with 192 additions and 146 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

[*.php, *.css, *.tpl, *.html, *.latte]
[*.php, *.css, *.tpl, *.html, *.latte, *.xml]
indent_style = tab
indent_size = 4

Expand Down
10 changes: 5 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,18 @@ language: php
php:
- 7.0
- 7.1
- 7.2

env:
matrix:
include:
- php: 7.0
env: coverage=on
- php: 7.1
env: coverage=on
- php: 7.2
env: coverage=off
env: coverage=on

allow_failures:
- php: 7.2
- php: 7.0
env: coverage=off

before_script:
Expand All @@ -26,7 +25,8 @@ before_script:
- if [ "$coverage" == "on" ]; then coverageArgs="--coverage ./coverage.xml --coverage-src ./app"; fi

script:
- vendor/bin/tester tests -s -c tests/php-unix.ini $coverageArgs
- composer code
- vendor/bin/tester tests -s -C $coverageArgs

after_script:
# Report Code Coverage
Expand Down
2 changes: 1 addition & 1 deletion app/entities/BlockEntity.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class BlockEntity implements IEntity

public $program;

public $display_progs;
public $displayProgs;

public $capacity;

Expand Down
8 changes: 4 additions & 4 deletions app/entities/PersonEntity.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ class PersonEntity implements IEntity

public $city;

public $postal_code;
public $postalCode;

public $created_at;
public $createdAt;

public $updated_at;
public $updatedAt;

public $deleted_at;
public $deletedAt;

/**
* @return int
Expand Down
6 changes: 3 additions & 3 deletions app/entities/SocialLoginEntity.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ class SocialLoginEntity implements IEntity

public $provider;

public $created_at;
public $createdAt;

public $updated_at;
public $updatedAt;

public $deleted_at;
public $deletedAt;

/**
* @return int
Expand Down
8 changes: 4 additions & 4 deletions app/entities/UserEntity.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
`<?php

namespace App\Entities;

Expand All @@ -13,11 +13,11 @@ class UserEntity implements IEntity

public $person;

public $created_at;
public $createdAt;

public $updated_at;
public $updatedAt;

public $deleted_at;
public $deletedAt;

/**
* @return int
Expand Down
8 changes: 4 additions & 4 deletions app/entities/VisitorEntity.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ class VisitorEntity

public $city;

public $postal_code;
public $postalCode;

public $birthday;

public $group_name;
public $groupName;

public $group_num;
public $groupNum;

public $troop_name;
public $troopName;

/**
* @return array
Expand Down
4 changes: 2 additions & 2 deletions app/models/ExportModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ public function evidence($visitorId = null)
' . $evidenceLimit, $this->getMeetingId(), '0')->fetchAll();
}

public static function getPdfBlocks($vid)
public static function getPdfBlocks($vid, string $meetingId)
{
$programs = "<tr>";
$programs .= " <td class='progPart'>";
Expand All @@ -204,7 +204,7 @@ public static function getPdfBlocks($vid)
program
FROM kk_blocks
WHERE deleted = ? AND program = ? AND meeting = ?
ORDER BY `day` ASC', '0', '1', $_SESSION['meetingID'])->fetchAll();
ORDER BY `day` ASC', '0', '1', $meetingId)->fetchAll();

if(!$data){
$programs .= "<div class='emptyTable' style='width:400px;'>Nejsou žádná aktuální data.</div>\n";
Expand Down
4 changes: 2 additions & 2 deletions app/models/MeetingModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class MeetingModel extends BaseModel
/**
* @var array
*/
public $form_names = [];
public $formNames = [];

/**
* @var array
Expand Down Expand Up @@ -57,7 +57,7 @@ class MeetingModel extends BaseModel
public function __construct(Context $database, ProgramModel $program)
{
$this->weekendDays = ["pátek", "sobota", "neděle"];
$this->form_names = [
$this->formNames = [
"place",
"start_date",
"end_date",
Expand Down
30 changes: 15 additions & 15 deletions app/models/ProgramModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ public function getPrograms($blockId, $vid)

$html = "<div>\n";

$checked_flag = false;
$html_input = "";
$checkedFlag = false;
$htmlInput = "";
foreach($blocks as $data){
// full program capacity with visitors
$fullProgramData = $this->database
Expand All @@ -107,13 +107,13 @@ public function getPrograms($blockId, $vid)

if($program){
$checked = "checked='checked'";
$checked_flag = true;
$checkedFlag = true;
} else {
$checked = "";
}
// if the capacity is full
if($fullProgramData['visitors'] >= $data['capacity']){
$html_input .= sprintf('<input id="%s%s" %s disabled type="radio" name="blck_%s" value="%s" />',
$htmlInput .= sprintf('<input id="%s%s" %s disabled type="radio" name="blck_%s" value="%s" />',
$data['id'],
$blockId,
$checked,
Expand All @@ -122,7 +122,7 @@ public function getPrograms($blockId, $vid)
);
$fullProgramInfo = " (NELZE ZAPSAT - kapacita programu je již naplněna!)";
} else {
$html_input .= sprintf('<input id="%s%s" %s type="radio" name="blck_%s" value="%s" />',
$htmlInput .= sprintf('<input id="%s%s" %s type="radio" name="blck_%s" value="%s" />',
$data['id'],
$blockId,
$checked,
Expand All @@ -131,17 +131,17 @@ public function getPrograms($blockId, $vid)
);
$fullProgramInfo = "";
}
$html_input .= sprintf('<label for="%s%s">%s</label>',
$htmlInput .= sprintf('<label for="%s%s">%s</label>',
$data['id'],
$blockId,
$data['name']
);
$html_input .= $fullProgramInfo;
$html_input .= "<br />\n";
$htmlInput .= $fullProgramInfo;
$htmlInput .= "<br />\n";
}

// pokud uz jednou bylo zaskrtnuto, nezaskrtavam znovu
if(!$checked_flag) {
if(!$checkedFlag) {
$checked = "checked='checked'";
} else {
$checked = "";
Expand All @@ -151,7 +151,7 @@ public function getPrograms($blockId, $vid)
$checked,
$blockId
);
$html .= $html_input;
$html .= $htmlInput;

$html .= "</div>\n";
}
Expand Down Expand Up @@ -279,12 +279,12 @@ public function renderExportPrograms()
*
* @return string html of a table
*/
public function getData($program_id = null)
public function getData($programId = null)
{
if(isset($program_id)) {
if(isset($programId)) {
$data = $this->database
->table($this->getTable())
->where('id ? AND deleted ?', $program_id, '0')
->where('id ? AND deleted ?', $programId, '0')
->limit(1)
->fetch();
} else {
Expand Down Expand Up @@ -420,12 +420,12 @@ public function getProgramsLarge($id){
return $html;
}

public static function getProgramNames($block_id)
public static function getProgramNames($blockId)
{
$result = self::$connection
->table('kk_programs')
->select('name')
->where('block ? AND deleted ?', $block_id, '0')
->where('block ? AND deleted ?', $blockId, '0')
->limit(10)
->fetchAll();

Expand Down
Loading

0 comments on commit 828b481

Please sign in to comment.