Revize 03ccdd65
Přidáno uživatelem Jakub Vašta před téměř 5 roky(ů)
website/src/OpenDataManager.php | ||
---|---|---|
17 | 17 |
|
18 | 18 |
public function getCollectionDataByName($name, $date, $hour) { |
19 | 19 |
$valh = $hour < 10 ? '0'.$hour : $hour; |
20 |
$openData = $this->manager->executeQuery('open-data-db.'.$name.$date, new Query(['date' => $date.$valh], [])); |
|
20 |
$openData = $this->manager->executeQuery('open-data-db.'.$name.$date, new Query(['date' => $date.'-'.$valh], []));
|
|
21 | 21 |
|
22 | 22 |
$openData->setTypeMap([ |
23 | 23 |
'array' => 'array', |
... | ... | |
46 | 46 |
$index = 0; |
47 | 47 |
foreach ($available as $key => $value) { |
48 | 48 |
if ($this->isCollectionAvailable($value['name'], $date) && false == array_key_exists($value['name'], $availableInDate)) { |
49 |
$availableInDate[$value['name']] = $index++;
|
|
49 |
$availableInDate[$value['name']] = $value['name'];
|
|
50 | 50 |
} |
51 | 51 |
} |
52 | 52 |
|
53 | 53 |
return $availableInDate; |
54 | 54 |
} |
55 | 55 |
|
56 |
public function getXthAvailableCollectionByDay($index, $date) { |
|
57 |
$availableInDate = []; |
|
58 |
$available = $this->getAvailableCollections(); |
|
59 |
$currentIndex = 0; |
|
60 |
|
|
61 |
foreach ($available as $key => $value) { |
|
62 |
if ($this->isCollectionAvailable($value['name'], $date) && false == array_key_exists($value['name'], $availableInDate)) { |
|
63 |
if ($currentIndex == $index) { |
|
64 |
return $value['name']; |
|
65 |
} else { |
|
66 |
++$currentIndex; |
|
67 |
} |
|
68 |
} |
|
69 |
} |
|
70 |
|
|
71 |
return ''; |
|
72 |
} |
|
73 |
|
|
74 | 56 |
public function isCollectionAvailable($name, $date) { |
75 | 57 |
$command = new Command(['listCollections' => 1, 'filter' => ['name' => $name.$date]]); |
76 | 58 |
$result = $this->manager->executeCommand('open-data-db', $command)->toArray(); |
Také k dispozici: Unified diff
+ vyřešení bugu s vybíráním datové sady