Skip to content

Commit

Permalink
Merge pull request #841 from project-primera/develop
Browse files Browse the repository at this point in the history
release 0.18.1
  • Loading branch information
slime-hatena committed Apr 16, 2024
2 parents a1ecab7 + 31867e8 commit ff89baf
Show file tree
Hide file tree
Showing 6 changed files with 78 additions and 40 deletions.
15 changes: 14 additions & 1 deletion OngekiScoreLog/app/Http/Controllers/AdminController.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,20 @@ public function GetConfig(){

public function GetAggregate(){
$result = \App\AggregateOverdamage::all();
return view('admin/aggregate', compact(['result']));
$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/aggregate', compact(['result', 'musics', 'difficultyToStr']));
}

/**
Expand Down
33 changes: 16 additions & 17 deletions OngekiScoreLog/app/Http/Controllers/ViewUserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,12 @@ public function getUserPage(Request $request, $id, $mode = null){
return view('user', compact('id', 'status', 'score', 'stat', 'mode', 'submenuActive', 'sidemark', 'archive'));
}

public function getOverDamegePage($id){
public function getOverDamegePage($id, $difficulty = ""){
// 存在しないdifficultyが指定された場合はリダイレクト
if(!in_array($difficulty, ["", "basic", "advanced", "expert", "master", "lunatic"])){
return redirect("/user/" . $id . "/overdamage");
}

$userStatus = new UserStatus();
$user = User::where('id' ,$id)->first();
$status = $userStatus->getRecentUserData($id);
Expand Down Expand Up @@ -380,30 +385,24 @@ public function getOverDamegePage($id){
// 自分のスコアを取得
$score = (new ScoreData)->getRecentUserScore($id)->addMusicData()->exclusionDeletedMusic()->getValue();

// 難易度を通常難易度1つ+LUNATICだけに絞る
// FIXME: こんなのコード側でやっちゃいけない... けどテーブル設計的にどうしようもなく...
$temp = [];
// 難易度を指定のものに絞る
$scoreDatas = [];
{
foreach ($score as $value) {
$key = $value->song_id;
if($value->difficulty === 10){
if($value->over_damage_high_score !== "0.00"){
if($value->over_damage_high_score !== "0.00"){
if(($difficulty === "" && ($value->difficulty === 3 || $value->difficulty === 10))
|| ($difficulty === "basic" && $value->difficulty === 0)
|| ($difficulty === "advanced" && $value->difficulty === 1)
|| ($difficulty === "expert" && $value->difficulty === 2)
|| ($difficulty === "master" && $value->difficulty === 3)
|| ($difficulty === "lunatic" && $value->difficulty === 10)
){
$scoreDatas[] = $value;
}
}else{
$temp[$key][] = $value;
}
}

foreach ($temp as $value) {
array_multisort(array_column($value, 'over_damage_high_score'), SORT_DESC, $value);
if($value[0]->over_damage_high_score !== "0.00"){
$scoreDatas[] = $value[0];
}
}
}

return view('user_overdamage', compact('id', 'status', 'lastUpdate', 'scoreDatas', 'topRankerScore'));
return view('user_overdamage', compact('id', 'difficulty', 'status', 'lastUpdate', 'scoreDatas', 'topRankerScore'));
}
}
51 changes: 35 additions & 16 deletions OngekiScoreLog/resources/views/admin/aggregate.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,45 @@
@include('admin/_submenu', ['active' => 'aggregate'])
@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>
<table class="table">
<thead>
<tr>
<th>id</th>
<th>max</th>
<th>updated_at</th>
</tr>
</thead>
<tbody>
@foreach ($result as $key => $value)
<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>
<td>{{$value->id}}</td>
<td>{{$value->max}}</td>
<td>{{$value->updated_at}}</td>
<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>
@endforeach
</tbody>
</table>
</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">{{$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
@@ -1,8 +1,17 @@
<div class="box">
<p>登録されている全ユーザーのオーバーダメージのうち、一番高いものと比較することが出来ます。<br>
(※全国ランキング1位のスコアではありません!)<br>
OD埋めなどにご活用ください。</p>
<p>プレイしている楽曲内で、一番ODが高い難易度のみ表示されます。全難易度のODが0の曲は表示されません。</p>
最終更新: {{$lastUpdate->format('Y-m-d H:i:s')}} (?%表示は未集計です)
<p>最終更新: {{$lastUpdate->format('Y-m-d H:i:s')}} (?%表示は未集計です)</p>

<div class="buttons has-addons">
<a href="/user/{{$id}}/overdamage" class="button{{($difficulty === "") ? "" : " is-primary"}}">Master + Lunatic</a>
<a href="/user/{{$id}}/overdamage/basic" class="button{{($difficulty === "basic") ? "" : " basic"}}">Basic</a>
<a href="/user/{{$id}}/overdamage/advanced" class="button{{($difficulty === "advanced") ? "" : " advanced"}}">Advanced</a>
<a href="/user/{{$id}}/overdamage/expert" class="button{{($difficulty === "expert") ? "" : " expert"}}">Expert</a>
<a href="/user/{{$id}}/overdamage/master" class="button{{($difficulty === "master") ? "" : " master"}}">Master</a>
<a href="/user/{{$id}}/overdamage/lunatic" class="button{{($difficulty === "lunatic") ? "" : " lunatic"}}">Lunatic</a>
</div>
</div>

<article class="box">
Expand Down
2 changes: 1 addition & 1 deletion OngekiScoreLog/resources/views/user_overdamage.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
{{-- @component('layouts/components/user/song_filter')
@endcomponent --}}

@component('layouts/components/user/song_status_overdamage', ['score' => $scoreDatas, 'topRankerScore' => $topRankerScore, 'id' => $id, 'lastUpdate' => $lastUpdate])
@component('layouts/components/user/song_status_overdamage', ['score' => $scoreDatas, 'topRankerScore' => $topRankerScore, 'id' => $id, 'difficulty' => $difficulty, 'lastUpdate' => $lastUpdate])
@endcomponent

@endsection
4 changes: 1 addition & 3 deletions OngekiScoreLog/routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@
Route::get('/user/{id}/trophy', 'ViewUserTrophyController@getIndex')->where(['id' => '\d+']);
Route::get('/user/{id}/music/{music}/{difficulty}', 'ViewUserMusicController@getIndex')->where(['id' => '\d+', 'music' => '\d+', 'difficulty' => '\w+']);
Route::get('/user/{id}/music/{music}', 'ViewUserMusicController@getRedirect')->where(['id' => '\d+', 'music' => '\d+']);
Route::middleware('throttle:5,1')->group(function () {
Route::get('/user/{id}/overdamage', 'ViewUserController@getOverDamegePage')->where(['id' => '\d+']);
});
Route::get('/user/{id}/overdamage/{difficulty?}', 'ViewUserController@getOverDamegePage')->where(['id' => '\d+', 'difficulty' => '\w+']);
Route::get('/user/{id}/{mode?}', 'ViewUserController@getUserPage')->where(['id' => '\d+']);

Route::middleware('throttle:3,1')->group(function () {
Expand Down

0 comments on commit ff89baf

Please sign in to comment.