Skip to content

Commit

Permalink
Merge pull request #853 from project-primera/feat/add-battlescore-agg…
Browse files Browse the repository at this point in the history
…regate

管理ページにbattlescoreの集計内容を追加
  • Loading branch information
slime-hatena committed Apr 30, 2024
2 parents 7427a18 + e15cc3e commit cfb889d
Show file tree
Hide file tree
Showing 6 changed files with 86 additions and 7 deletions.
23 changes: 21 additions & 2 deletions OngekiScoreLog/app/Http/Controllers/AdminController.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,26 @@ public function GetConfig(){
return view('admin/config', compact(['result']));
}

public function GetAggregate(){
public function GetBattle(){
$result = \App\AggregateBattleScore::all();
$difficultyToStr = [
0 => 'Basic',
1 => 'Advanced',
2 => 'Expert',
3 => 'Master',
10 => 'Lunatic',
];

$musics = [];
$temp = \App\MusicData::all();
foreach ($temp as $value) {
$musics[$value->id] = $value->title;
}
return view('admin/battle', compact(['result', 'musics', 'difficultyToStr']));
}


public function GetOverDamage(){
$result = \App\AggregateOverdamage::all();
$difficultyToStr = [
0 => 'Basic',
Expand All @@ -84,7 +103,7 @@ public function GetAggregate(){
foreach ($temp as $value) {
$musics[$value->id] = $value->title;
}
return view('admin/aggregate', compact(['result', 'musics', 'difficultyToStr']));
return view('admin/overdamage', compact(['result', 'musics', 'difficultyToStr']));
}

/**
Expand Down
11 changes: 9 additions & 2 deletions OngekiScoreLog/resources/views/admin/_submenu.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,16 @@
@endif
<a href="/admin/config">config</a></li>

@if (isset($active) && $active === 'aggregate')
@if (isset($active) && $active === 'battle')
<li class="is-active">
@else
<li>
@endif
<a href="/admin/aggregate">aggregate</a></li>
<a href="/admin/battle">battle</a></li>

@if (isset($active) && $active === 'overdamage')
<li class="is-active">
@else
<li>
@endif
<a href="/admin/overdamage">overdamage</a></li>
52 changes: 52 additions & 0 deletions OngekiScoreLog/resources/views/admin/battle.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
@extends('layouts.app')

@section('title', '管理ページ')
@section('hero_title', "管理ページ")
@section('hero_subtitle', "config")

@section('submenu')
@include('admin/_submenu', ['active' => 'battle'])
@endsection

@section('additional_footer')
<script type="text/javascript" src="{{ mix('/js/sortTable.js') }}"></script>
@endsection

@section('content')
<article class="box">
<h3 class="title is-3">集計一覧</h3>
<div id="sort_table" class="table_wrap scalable">
<table class="table">
<thead>
<tr>
<th class="sort" data-sort="sort_key1">id</th>
<th>title</th>
<th>難易度</th>
<th class="sort" data-sort="sort_key2">max</th>
<th class="sort" data-sort="sort_key3">updated_at</th>
</tr>
</thead>
<tfoot>
<tr>
<th class="sort" data-sort="sort_key1">id</th>
<th>title</th>
<th>難易度</th>
<th class="sort" data-sort="sort_key2">max</th>
<th class="sort" data-sort="sort_key3">updated_at</th>
</tr>
</tfoot>
<tbody class="list">
@foreach ($result as $key => $value)
<tr>
<td class="sort_key1">{{$value->id}}</td>
<td>{{$musics[$value->song_id]}}</td>
<td>{{substr($difficultyToStr[$value->difficulty], 0, 3)}}</td>
<td class="sort_key2"><span class="sort-key">{{$value->max}}</span>{{number_format($value->max)}}</td>
<td class="sort_key3">{{$value->updated_at}}</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</article>
@endsection
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
@section('hero_subtitle', "config")

@section('submenu')
@include('admin/_submenu', ['active' => 'aggregate'])
@include('admin/_submenu', ['active' => 'overdamage'])
@endsection

@section('additional_footer')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
<td class="sort_key3">0.00%</td>
@else
{{-- 1位ではないので計算 --}}
<td class="sort_key3">{{number_format((floor((($s->over_damage_high_score) / ($topRankerScore[$s->song_id . "_" . $s->difficulty])) * 100) / 100), 2)}}%</td>
<td class="sort_key3">{{number_format(($s->battle_high_score / $topRankerScore[$s->song_id . "_" . $s->difficulty]) * 100, 2)}}%</td>
@endif
@else
<td class="sort_key1">?%</td>
Expand Down
3 changes: 2 additions & 1 deletion OngekiScoreLog/routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@
Route::group(['middleware' => ['auth', 'can:admin']], function () {
Route::get('/admin', 'AdminController@GetIndex');
Route::get('/admin/config', 'AdminController@GetConfig');
Route::get('/admin/aggregate', 'AdminController@GetAggregate');
Route::get('/admin/battle', 'AdminController@GetBattle');
Route::get('/admin/overdamage', 'AdminController@GetOverDamage');
Route::get('/admin/apply/{type}/{action?}', 'AdminController@GetApply');
Route::get('/admin/generate/battle-score', 'AdminController@GetGenerateBattleScore');
Route::get('/admin/generate/over-damage', 'AdminController@GetGenerateOverDamage');
Expand Down

0 comments on commit cfb889d

Please sign in to comment.