Skip to content

Commit

Permalink
[bug] perbaiki issue #165 dan #166 (#167)
Browse files Browse the repository at this point in the history
  • Loading branch information
agungsugiarto authored Jun 22, 2023
1 parent 329d2e1 commit 9dbf8ee
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions app/Models/Desa.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,7 @@ public function scopeJumlahDesa($query)
$versi_opensid = lastrelease('https://api.github.com/repos/OpenSID/rilis-premium/releases/latest');

if ($versi_opensid !== false) {
$version = $versi_opensid->tag_name;
$version = preg_replace('/[^0-9]/', '', $version);
$version = substr($version, 0, 2).'.'.substr($version, 2, 2);
$version = str_replace('v', '', $versi_opensid->tag_name);
}

if ($provinsi = session('provinsi')) {
Expand All @@ -73,7 +71,7 @@ public function scopeJumlahDesa($query)
->selectRaw("(select count(id) from desa as x where x.versi_lokal <> '' and x.versi_hosting is null and coalesce(x.tgl_akses_lokal, 0) >= now() - interval 7 day {$states}) desa_offline")
->selectRaw("(select count(id) from desa as x where x.versi_hosting <> '' and greatest(coalesce(x.tgl_akses_lokal, 0), coalesce(x.tgl_akses_hosting, 0)) >= now() - interval 7 day {$states}) desa_online")
->selectRaw('count(distinct kode_kabupaten) as kabupaten_total')
->selectRaw("(select count(distinct x.kode_kabupaten) from desa as x where (x.versi_hosting LIKE '{$version}-premium%' Or x.versi_lokal LIKE '{$version}-premium%') {$states} ) as kabupaten_premium")
->selectRaw("(select count(distinct x.kode_kabupaten) from desa as x where (x.versi_hosting like '{$version}-premium%' or x.versi_lokal like '{$version}-premium%') {$states} ) as kabupaten_premium")
->selectRaw("(select count(distinct x.kode_kabupaten) from desa as x where x.versi_lokal <> '' {$states}) kabupaten_offline")
->selectRaw("(select count(distinct x.kode_kabupaten) from desa as x where x.versi_hosting <> '' {$states}) kabupaten_online")
->selectRaw("(select count(id) from desa as x where x.jenis = 2 {$states}) bukan_desa")
Expand Down Expand Up @@ -173,12 +171,10 @@ public function scopeKabupatenOpenSID($query, $fillters = [])
$versi_opensid = lastrelease('https://api.github.com/repos/OpenSID/rilis-premium/releases/latest');

if ($versi_opensid !== false) {
$version = $versi_opensid->tag_name;
$version = preg_replace('/[^0-9]/', '', $version);
$version = substr($version, 0, 2).'.'.substr($version, 2, 2);
$version = str_replace('v', '', $versi_opensid->tag_name);

$query->where('d.versi_hosting', 'LIKE', $version.'-premium%')
->orWhere('d.versi_lokal', 'LIKE', $version.'-premium%');
$query->where('d.versi_hosting', 'like', "{$version}-premium%")
->orWhere('d.versi_lokal', 'like', "{$version}-premium%");
}
});
}, 'sub')
Expand Down

0 comments on commit 9dbf8ee

Please sign in to comment.