@@ -90,7 +90,12 @@ function shapingKeys($array){
9090 }
9191 }
9292 }
93-
93+ # レーティングの計算を行うのでプレミアムかどうかの確認をする。
94+ $ isPremium = false ;
95+ $ targetUser = User::where ('id ' ,$ id )->first ();
96+ if (\App \UserInformation::IsPremiumPlan ($ targetUser ->id )){
97+ $ isPremium = true ;
98+ }
9499 $ score = [
95100 'new ' =>[
96101 'Basic ' => [
@@ -222,8 +227,11 @@ function shapingKeys($array){
222227 $ progress [$ music ][$ difficulty ]["difference " ]['over_damage_high_score_rank ' ] = "不可 " . " → " . $ value ->over_damage_high_score_rank ;
223228 $ progress [$ music ][$ difficulty ]["difference " ]['is_update_over_damage_high_score_rank ' ] = "update " ;
224229 $ progress [$ music ][$ difficulty ]["difference " ]['over_damage_high_score ' ] = "+ " . ($ value ->over_damage_high_score ) . "% " ;
225- $ progress [$ music ][$ difficulty ]["difference " ]['normal_rating ' ] = "+ " . sprintf ("%.3f " , $ newNormalRating );
226- $ progress [$ music ][$ difficulty ]["difference " ]["new-normal-rating " ] = sprintf ("%.3f " , $ newNormalRating );
230+ if ($ isPremium ) {
231+ $ newNormalRating = OngekiUtility::RateValueFromTitle ($ value ->title , $ value ->difficulty , $ value ->technical_high_score , $ value ->lampForRating , $ value ->genre , $ value ->artist );
232+ $ progress [$ music ][$ difficulty ]["difference " ]['normal_rating ' ] = "+ " . sprintf ("%.3f " , $ newNormalRating );
233+ $ progress [$ music ][$ difficulty ]["difference " ]["new-normal-rating " ] = sprintf ("%.3f " , $ newNormalRating );
234+ }
227235 $ progress [$ music ][$ difficulty ]["difference " ]['old-lamp-is-fb ' ] = "not-light " ;
228236 $ progress [$ music ][$ difficulty ]["difference " ]['old-lamp-is-fc ' ] = "not-light " ;
229237 $ progress [$ music ][$ difficulty ]["difference " ]['old-lamp-is-ab ' ] = "not-light " ;
@@ -259,8 +267,11 @@ function shapingKeys($array){
259267 $ progress [$ music ][$ difficulty ]["difference " ]['over_damage_high_score_rank ' ] = "N " . " → " . $ value ->over_damage_high_score_rank ;
260268 $ progress [$ music ][$ difficulty ]["difference " ]['is_update_over_damage_high_score_rank ' ] = "update " ;
261269 $ progress [$ music ][$ difficulty ]["difference " ]['over_damage_high_score ' ] = "+ " . ($ value ->over_damage_high_score ) . "% " ;
262- $ progress [$ music ][$ difficulty ]["difference " ]['normal_rating ' ] = "+ " . sprintf ("%.3f " , $ newNormalRating );
263- $ progress [$ music ][$ difficulty ]["difference " ]["new-normal-rating " ] = sprintf ("%.3f " , $ newNormalRating );
270+ if ($ isPremium ) {
271+ $ newNormalRating = OngekiUtility::RateValueFromTitle ($ value ->title , $ value ->difficulty , $ value ->technical_high_score , $ value ->lampForRating , $ value ->genre , $ value ->artist );
272+ $ progress [$ music ][$ difficulty ]["difference " ]['normal_rating ' ] = "+ " . sprintf ("%.3f " , $ newNormalRating );
273+ $ progress [$ music ][$ difficulty ]["difference " ]["new-normal-rating " ] = sprintf ("%.3f " , $ newNormalRating );
274+ }
264275 $ progress [$ music ][$ difficulty ]["difference " ]['old-lamp-is-fb ' ] = "not-light " ;
265276 $ progress [$ music ][$ difficulty ]["difference " ]['old-lamp-is-fc ' ] = "not-light " ;
266277 $ progress [$ music ][$ difficulty ]["difference " ]['old-lamp-is-ab ' ] = "not-light " ;
@@ -295,34 +306,37 @@ function shapingKeys($array){
295306 // Rating計算はできるだけ少なくしたいので先に計算しておく。
296307 // ViewUserRatingController.php から引用。
297308 // WARNING: レーティング処理を変えたら変更元も変更する!
298- $ oldLampForRating = "" ;
299- if ($ old [$ music ][$ difficulty ]->technical_high_score == 1010000 ){
300- if ($ old [$ music ][$ difficulty ]->full_bell == 1 ) {
301- $ oldLampForRating = "FB/AB+ " ;
309+ if ($ isPremium ) {
310+ $ oldLampForRating = "" ;
311+ if ($ old [$ music ][$ difficulty ]->technical_high_score == 1010000 ){
312+ if ($ old [$ music ][$ difficulty ]->full_bell == 1 ) {
313+ $ oldLampForRating = "FB/AB+ " ;
314+ } else {
315+ $ oldLampForRating = "AB+ " ;
316+ }
317+ } elseif ($ old [$ music ][$ difficulty ]->all_break == 1 ) {
318+ if ($ old [$ music ][$ difficulty ]->full_bell == 1 ) {
319+ $ oldLampForRating = "FB/AB " ;
320+ } else {
321+ $ oldLampForRating = "AB " ;
322+ }
323+ } elseif ($ old [$ music ][$ difficulty ]->full_combo == 1 ) {
324+ if ($ old [$ music ][$ difficulty ]->full_bell == 1 ) {
325+ $ oldLampForRating = "FB/FC " ;
326+ } else {
327+ $ oldLampForRating = "FC " ;
328+ }
302329 } else {
303- $ oldLampForRating = "AB+ " ;
330+ if ($ old [$ music ][$ difficulty ]->full_bell == 1 ) {
331+ $ oldLampForRating = "FB " ;
332+ }
304333 }
305- } elseif ($ old [$ music ][$ difficulty ]->all_break == 1 ) {
306- if ($ old [$ music ][$ difficulty ]->full_bell == 1 ) {
307- $ oldLampForRating = "FB/AB " ;
308- } else {
309- $ oldLampForRating = "AB " ;
310- }
311- } elseif ($ old [$ music ][$ difficulty ]->full_combo == 1 ) {
312- if ($ old [$ music ][$ difficulty ]->full_bell == 1 ) {
313- $ oldLampForRating = "FB/FC " ;
314- } else {
315- $ oldLampForRating = "FC " ;
316- }
317- } else {
318- if ($ old [$ music ][$ difficulty ]->full_bell == 1 ) {
319- $ oldLampForRating = "FB " ;
320- }
321- }
322-
323- $ newNormalRating = OngekiUtility::RateValueFromTitle ($ value ->title , $ value ->difficulty , $ value ->technical_high_score , $ value ->lampForRating , $ value ->genre , $ value ->artist );
324- $ oldNormalRating = OngekiUtility::RateValueFromTitle ($ value ->title , $ old [$ music ][$ difficulty ]->difficulty , $ old [$ music ][$ difficulty ]->technical_high_score , $ oldLampForRating , $ value ->genre , $ value ->artist );
325334
335+ $ newNormalRating = OngekiUtility::RateValueFromTitle ($ value ->title , $ value ->difficulty , $ value ->technical_high_score , $ value ->lampForRating , $ value ->genre , $ value ->artist );
336+ $ oldNormalRating = OngekiUtility::RateValueFromTitle ($ value ->title , $ old [$ music ][$ difficulty ]->difficulty , $ old [$ music ][$ difficulty ]->technical_high_score , $ oldLampForRating , $ value ->genre , $ value ->artist );
337+ $ progress [$ music ][$ difficulty ]["difference " ]['normal_rating ' ] = ($ newNormalRating - $ oldNormalRating ) != 0 ? "+ " . sprintf ("%.3f " ,($ newNormalRating - $ oldNormalRating )) : "" ;
338+ $ progress [$ music ][$ difficulty ]["difference " ]["new-normal-rating " ] = sprintf ("%.3f " , $ newNormalRating );
339+ }
326340 $ progress [$ music ][$ difficulty ]["difference " ]['battle_high_score ' ] = ($ value ->battle_high_score - $ old [$ music ][$ difficulty ]->battle_high_score ) != 0 ? "+ " . number_format ($ value ->battle_high_score - $ old [$ music ][$ difficulty ]->battle_high_score ) : "" ;
327341 $ progress [$ music ][$ difficulty ]["difference " ]['technical_high_score ' ] = ($ value ->technical_high_score - $ old [$ music ][$ difficulty ]->technical_high_score ) != 0 ? "+ " . number_format ($ value ->technical_high_score - $ old [$ music ][$ difficulty ]->technical_high_score ) : "" ;
328342 $ progress [$ music ][$ difficulty ]["difference " ]['platinum_score ' ] = ($ value ->platinum_score - $ old [$ music ][$ difficulty ]->platinum_score ) != 0 ? "+ " . number_format ($ value ->platinum_score - $ old [$ music ][$ difficulty ]->platinum_score ) : "" ;
@@ -332,8 +346,6 @@ function shapingKeys($array){
332346 $ progress [$ music ][$ difficulty ]["difference " ]['over_damage_high_score_rank ' ] = $ old [$ music ][$ difficulty ]->over_damage_high_score_rank . " → " . $ value ->over_damage_high_score_rank ;
333347 $ progress [$ music ][$ difficulty ]["difference " ]['is_update_over_damage_high_score_rank ' ] = ($ old [$ music ][$ difficulty ]->over_damage_high_score_rank != $ value ->over_damage_high_score_rank ) ? "update " : "" ;
334348 $ progress [$ music ][$ difficulty ]["difference " ]['over_damage_high_score ' ] = ($ value ->over_damage_high_score - $ old [$ music ][$ difficulty ]->over_damage_high_score ) != 0 ? "+ " . (floor (($ value ->over_damage_high_score - $ old [$ music ][$ difficulty ]->over_damage_high_score ) * 100 ) / 100 ) . "% " : "" ;
335- $ progress [$ music ][$ difficulty ]["difference " ]['normal_rating ' ] = ($ newNormalRating - $ oldNormalRating ) != 0 ? "+ " . sprintf ("%.3f " ,($ newNormalRating - $ oldNormalRating )) : "" ;
336- $ progress [$ music ][$ difficulty ]["difference " ]["new-normal-rating " ] = sprintf ("%.3f " , $ newNormalRating );
337349 $ progress [$ music ][$ difficulty ]["difference " ]['old-lamp-is-fb ' ] = $ old [$ music ][$ difficulty ]->full_bell ? "full-bell " : "not-light " ;
338350 $ progress [$ music ][$ difficulty ]["difference " ]['old-lamp-is-fc ' ] = $ old [$ music ][$ difficulty ]->full_combo ? "full-combo " : "not-light " ;
339351 $ progress [$ music ][$ difficulty ]["difference " ]['old-lamp-is-ab ' ] = $ old [$ music ][$ difficulty ]->all_break ? "all-break " : "not-light " ;
@@ -396,6 +408,6 @@ function shapingKeys($array){
396408 ]
397409 ];
398410
399- return view ('user_progress ' , compact ('filter ' , 'url ' , 'status ' , 'progress ' , 'date ' , 'score ' , 'version ' , 'display ' , 'id ' , 'sidemark ' , 'isLoggedIn ' , 'isTwitterEnabled ' , 'twitterScreenName ' ));
411+ return view ('user_progress ' , compact ('filter ' , 'url ' , 'status ' , 'progress ' , 'date ' , 'score ' , 'version ' , 'display ' , 'id ' , 'sidemark ' , 'isLoggedIn ' , 'isTwitterEnabled ' , 'twitterScreenName ' , ' isPremium ' ));
400412 }
401413}
0 commit comments