Revize afb0cc02
Přidáno uživatelem Jakub Vašta před téměř 5 roky(ů)
website/src/Repository/OpenDataManager.php | ||
---|---|---|
16 | 16 |
} |
17 | 17 |
|
18 | 18 |
public function getCollectionDataByName($name, $date, $hour) { |
19 |
if (null == $name || null == $date || null == $hour) { |
|
20 |
return []; |
|
21 |
} |
|
22 |
|
|
19 | 23 |
$valh = $hour < 10 ? '0'.$hour : $hour; |
20 | 24 |
$openData = $this->manager->executeQuery('open-data-db.'.$name.$date, new Query(['date' => $date.'-'.$valh], [])); |
21 | 25 |
|
... | ... | |
54 | 58 |
} |
55 | 59 |
|
56 | 60 |
public function isCollectionAvailable($name, $date) { |
61 |
if (null == $name || null == $date) { |
|
62 |
return false; |
|
63 |
} |
|
64 |
|
|
57 | 65 |
$result = $this->manager->executeQuery('open-data-db.'.$name, new Query(['date' => $date], [])); |
58 | 66 |
|
59 | 67 |
return !empty($result->toArray()); |
... | ... | |
90 | 98 |
} |
91 | 99 |
|
92 | 100 |
public function getMaxCollectionNumberAtDay($name, $date) { |
101 |
if (null == $name || null == $date) { |
|
102 |
return 0; |
|
103 |
} |
|
104 |
|
|
93 | 105 |
$max = $this->manager->executeQuery('open-data-db.'.$name.$date, new Query([], ['sort' => ['number' => -1], 'limit' => 1])); |
94 | 106 |
|
95 | 107 |
$max->setTypeMap([ |
... | ... | |
100 | 112 |
|
101 | 113 |
$result = $max->toArray(); |
102 | 114 |
|
103 |
return empty($result) ? 1 : $result[0]['number'];
|
|
115 |
return empty($result) ? 0 : $result[0]['number'];
|
|
104 | 116 |
} |
105 | 117 |
|
106 | 118 |
public function getDataSourcePositions($name = 'NONE') { |
119 |
if (null == $name) { |
|
120 |
return []; |
|
121 |
} |
|
122 |
|
|
107 | 123 |
$positions = $this->manager->executeQuery('open-data-db.'.$name.'DEVICES', new Query([], [])); |
108 | 124 |
|
109 | 125 |
$positions->setTypeMap([ |
Také k dispozici: Unified diff
+ Re #8081
+ tests environmnet prepared
+ fast fix in build script