Skip to content

Commit

Permalink
[ci skip] Fix styling
Browse files Browse the repository at this point in the history
  • Loading branch information
pandigresik authored and github-actions[bot] committed Jun 12, 2024
1 parent ff09c63 commit 5718e5a
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 23 deletions.
40 changes: 20 additions & 20 deletions app/Http/Controllers/WebsiteDashboardController.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,19 @@ public function summary(Request $request)
$kabupaten = $request->get('kabupaten');
$kecamatan = $request->get('kecamatan');
$summary = Desa::selectRaw('count(distinct kode_desa) as desa, count(distinct kode_kecamatan) as kecamatan, count(distinct kode_kabupaten) as kabupaten, count(distinct kode_provinsi) as provinsi');
$summarySebelumnya = Desa::selectRaw('count(distinct kode_desa) as desa, count(distinct kode_kecamatan) as kecamatan, count(distinct kode_kabupaten) as kabupaten, count(distinct kode_provinsi) as provinsi');
$summarySebelumnya = Desa::selectRaw('count(distinct kode_desa) as desa, count(distinct kode_kecamatan) as kecamatan, count(distinct kode_kabupaten) as kabupaten, count(distinct kode_provinsi) as provinsi');

$tanggalAkhir = explode(' - ', $period)[1];
$summary->where('created_at', '<=', $tanggalAkhir);
$summarySebelumnya->where('created_at', '<=', Carbon::parse($tanggalAkhir)->subMonth()->format('Y-m-d'));
$desaAktif = Desa::aktif($tanggalAkhir);
$desaAktifOnline = Desa::aktifOnline($tanggalAkhir);

$opensid = Desa::aktif($tanggalAkhir)->select(['nama_desa'])->limit(7)->get();
$opendk = Opendk::aktif($tanggalAkhir)->select(['nama_kecamatan'])->limit(7)->get();
$layanan = TrackMobile::aktif($tanggalAkhir)->distinct()->select(['kode_desa'])->limit(7)->get();
$kelolaDesa = TrackKeloladesa::aktif($tanggalAkhir)->distinct()->select(['kode_desa'])->limit(7)->get();

if ($provinsi) {
$summary->where('kode_provinsi', $provinsi);
$summarySebelumnya->where('kode_provinsi', $provinsi);
Expand Down Expand Up @@ -99,39 +99,39 @@ public function chartUsage(Request $request)
$period = $request->get('period');
$provinsi = $request->get('provinsi');
$kabupaten = $request->get('kabupaten');
$kecamatan = $request->get('kecamatan');
list($tanggalAwal,$tanggalAkhir) = explode(' - ', $period);
$kecamatan = $request->get('kecamatan');
[$tanggalAwal, $tanggalAkhir] = explode(' - ', $period);
// range minimal 7 hari, max 31 hari
$minTanggal = Carbon::parse($tanggalAkhir)->subDays(7)->format('Y-m-d');
$maxTanggal = Carbon::parse($tanggalAkhir)->subDays(31)->format('Y-m-d');
$hariIni = Carbon::now()->format('Y-m-d');
if ($tanggalAkhir > $hariIni){
if ($tanggalAkhir > $hariIni) {
$tanggalAkhir = $hariIni;
}
if($tanggalAwal > $minTanggal){
if ($tanggalAwal > $minTanggal) {
$tanggalAwal = $minTanggal;
}
if($tanggalAwal < $maxTanggal){
if ($tanggalAwal < $maxTanggal) {
$tanggalAwal = $maxTanggal;
}

$rangeTanggal = CarbonPeriod::between($tanggalAwal, $tanggalAkhir);
$opensid = Desa::aktif($tanggalAkhir);
$opensid = Desa::aktif($tanggalAkhir);
$listDesa = Desa::select(['kode_desa']);
$opendk = Opendk::aktif($tanggalAkhir);
$layanan = TrackMobile::aktif($tanggalAkhir);
$kelolaDesa = TrackKeloladesa::aktif($tanggalAkhir);
if($provinsi){
if ($provinsi) {
$opensid->where('kode_provinsi', $provinsi);
$opendk->where('kode_provinsi', $provinsi);
$listDesa->where('kode_provinsi', $provinsi);
}
if($kabupaten){
if ($kabupaten) {
$opensid->where('kode_kabupaten', $kabupaten);
$opendk->where('kode_kabupaten', $kabupaten);
$listDesa->where('kode_kabupaten', $kabupaten);
}
if($kecamatan){
if ($kecamatan) {
$opensid->where('kode_kecamatan', $kecamatan);
$opendk->where('kode_kecamatan', $kecamatan);
$listDesa->where('kode_kecamatan', $kecamatan);
Expand All @@ -149,20 +149,20 @@ public function chartUsage(Request $request)
$opendkCount = $opendk->count();
$layananCount = $layanan->count();
$kelolaCount = $kelolaDesa->count();
foreach($rangeTanggal as $tanggal){
foreach ($rangeTanggal as $tanggal) {
$labels[] = $tanggal->format('j M');
if($tanggal->format('Y-m-d') == $tanggalAkhir){
if ($tanggal->format('Y-m-d') == $tanggalAkhir) {
$opensidData[] = $opensidCount;
$opendkData[] = $opendkCount;
$layananData[] = $layananCount;
$kelolaData[] = $kelolaCount;
}else {
$opensidData[] = $opensidCount + random_int(0, 30) ;
$opendkData[] = $opendkCount + random_int(0, 5) ;
$layananData[] = $layananCount + random_int(0, 15) ;
$kelolaData[] = $kelolaCount + random_int(0, 15) ;
} else {
$opensidData[] = $opensidCount + random_int(0, 30);
$opendkData[] = $opendkCount + random_int(0, 5);
$layananData[] = $layananCount + random_int(0, 15);
$kelolaData[] = $kelolaCount + random_int(0, 15);
}

$openkabData[] = 0;
}
$result = [
Expand Down
2 changes: 1 addition & 1 deletion app/Models/Opendk.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,6 @@ public function scopeAktif($query, $batasTgl)
{
$maksimalTanggal = Carbon::parse($batasTgl)->subDays(7)->format('Y-m-d');

return $query->where('updated_at','>=', $maksimalTanggal);
return $query->where('updated_at', '>=', $maksimalTanggal);
}
}
2 changes: 1 addition & 1 deletion app/Models/TrackKeloladesa.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,6 @@ public function scopeAktif($query, $batasTgl)
{
$maksimalTanggal = Carbon::parse($batasTgl)->subDays(self::ACTIVE_DAYS)->format('Y-m-d');

return $query->where('tgl_akses','>=', $maksimalTanggal);
return $query->where('tgl_akses', '>=', $maksimalTanggal);
}
}
2 changes: 1 addition & 1 deletion app/Models/TrackMobile.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,6 @@ public function scopeAktif($query, $batasTgl)
{
$maksimalTanggal = Carbon::parse($batasTgl)->subDays(self::ACTIVE_DAYS)->format('Y-m-d');

return $query->where('tgl_akses','>=', $maksimalTanggal);
return $query->where('tgl_akses', '>=', $maksimalTanggal);
}
}

0 comments on commit 5718e5a

Please sign in to comment.