Skip to content

Commit

Permalink
Merge branch 'master' into contest-show-votes-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
notbakaneko authored Feb 1, 2024
2 parents cac9cb1 + 0f0b689 commit a795964
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 53 deletions.
23 changes: 23 additions & 0 deletions database/migrations/2024_01_31_181425_unview_scores.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the GNU Affero General Public License v3.0.
// See the LICENCE file in the repository root for full licence text.

declare(strict_types=1);

use Illuminate\Database\Migrations\Migration;

return new class extends Migration
{
public function up(): void
{
DB::statement('DROP VIEW scores');
DB::statement('ALTER TABLE solo_scores RENAME TO scores');
}

public function down(): void
{
DB::statement('ALTER TABLE scores RENAME TO solo_scores');
DB::statement('CREATE VIEW scores AS SELECT * from solo_scores');
}
};
52 changes: 7 additions & 45 deletions public/images/layout/osu-lazer-logo-white.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 5 additions & 4 deletions resources/js/beatmapsets-show/scoreboard/table-row.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import PpValue from 'scores/pp-value';
import { classWithModifiers, Modifiers } from 'utils/css';
import { formatNumber } from 'utils/html';
import { trans } from 'utils/lang';
import { filterMods, hasMenu, isPerfectCombo, modeAttributesMap, scoreUrl, totalScore } from 'utils/score-helper';
import { accuracy, filterMods, hasMenu, isPerfectCombo, modeAttributesMap, rank, scoreUrl, totalScore } from 'utils/score-helper';

const bn = 'beatmap-scoreboard-table';

Expand Down Expand Up @@ -63,6 +63,7 @@ export default class ScoreboardTableRow extends React.Component<Props> {

render() {
const score = this.props.score;
const scoreAccuracy = accuracy(score);
const blockClass = classWithModifiers(`${bn}__body-row`,
this.props.activated ? 'menu-active' : 'highlightable',
{
Expand All @@ -79,15 +80,15 @@ export default class ScoreboardTableRow extends React.Component<Props> {
</TdLink>

<TdLink href={this.scoreUrl} modifiers='grade'>
<div className={classWithModifiers('score-rank', ['tiny', score.rank])} />
<div className={classWithModifiers('score-rank', ['tiny', rank(score)])} />
</TdLink>

<TdLink href={this.scoreUrl} modifiers='score'>
{formatNumber(totalScore(score))}
</TdLink>

<TdLink href={this.scoreUrl} modifiers={{ perfect: score.accuracy === 1 }}>
{`${formatNumber(score.accuracy * 100, 2)}%`}
<TdLink href={this.scoreUrl} modifiers={{ perfect: scoreAccuracy === 1 }}>
{`${formatNumber(scoreAccuracy * 100, 2)}%`}
</TdLink>

<td className={`${bn}__cell`}>
Expand Down
9 changes: 5 additions & 4 deletions resources/js/beatmapsets-show/scoreboard/top-card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { rulesetName, shouldShowPp } from 'utils/beatmap-helper';
import { classWithModifiers, Modifiers } from 'utils/css';
import { formatNumber } from 'utils/html';
import { trans } from 'utils/lang';
import { filterMods, isPerfectCombo, modeAttributesMap, scoreUrl, totalScore } from 'utils/score-helper';
import { accuracy, filterMods, isPerfectCombo, modeAttributesMap, rank, scoreUrl, totalScore } from 'utils/score-helper';

interface Props {
beatmap: BeatmapJson;
Expand All @@ -31,6 +31,7 @@ interface Props {
export default class TopCard extends React.PureComponent<Props> {
render() {
const ruleset = rulesetName(this.props.score.ruleset_id);
const scoreAccuracy = accuracy(this.props.score);
const avatar = <UserAvatar user={this.props.score.user} />;

return (
Expand All @@ -46,7 +47,7 @@ export default class TopCard extends React.PureComponent<Props> {
<div className='beatmap-score-top__position-number'>
{this.props.position != null ? `#${this.props.position}` : '-'}
</div>
<div className={classWithModifiers('score-rank', 'tiny', this.props.score.rank)} />
<div className={classWithModifiers('score-rank', 'tiny', rank(this.props.score))} />
</div>

<div className='beatmap-score-top__avatar'>
Expand Down Expand Up @@ -124,10 +125,10 @@ export default class TopCard extends React.PureComponent<Props> {
</div>
<div
className={classWithModifiers('beatmap-score-top__stat-value', {
perfect: this.props.score.accuracy === 1,
perfect: scoreAccuracy === 1,
})}
>
{formatNumber(this.props.score.accuracy * 100, 2)}%
{formatNumber(scoreAccuracy * 100, 2)}%
</div>
</div>

Expand Down
4 changes: 4 additions & 0 deletions resources/views/scores/show.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,9 @@
{!! json_encode($scoreJson) !!}
</script>

<script id="json-raw" type="application/json">
{!! json_encode($score->getAttributes()) !!}
</script>

@include('layout._react_js', ['src' => 'js/scores-show.js'])
@endsection

0 comments on commit a795964

Please sign in to comment.