Skip to content

Commit

Permalink
Merge branch 'master' into delayout-react-container
Browse files Browse the repository at this point in the history
  • Loading branch information
notbakaneko authored Oct 11, 2024
2 parents 2301853 + f2e46c5 commit d489d96
Show file tree
Hide file tree
Showing 16 changed files with 105 additions and 234 deletions.
1 change: 0 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,6 @@ CLIENT_CHECK_VERSION=false
# BAN_PERSIST_DAYS=28

# ES_HOST=localhost:9200
# ES_SCORES_HOST=localhost:9200
# ES_SOLO_SCORES_HOST=localhost:9200
# ES_INDEX_PREFIX=
# ES_CLIENT_TIMEOUT=5
Expand Down
30 changes: 0 additions & 30 deletions app/Console/Commands/UserBestScoresCheckCommand.php

This file was deleted.

12 changes: 0 additions & 12 deletions app/Http/Controllers/LegacyInterOpController.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
use App\Jobs\Notifications\ForumTopicReply;
use App\Jobs\RegenerateBeatmapsetCover;
use App\Libraries\Chat;
use App\Libraries\UserBestScoresCheck;
use App\Models\Beatmap;
use App\Models\Beatmapset;
use App\Models\Chat\Channel;
Expand Down Expand Up @@ -297,17 +296,6 @@ public function userBatchSendMessage()
return response()->json($results);
}

public function userBestScoresCheck($id)
{
$user = User::findOrFail($id);

foreach (Beatmap::MODES as $mode => $_v) {
(new UserBestScoresCheck($user))->run($mode);
}

return ['success' => true];
}

public function userIndex($id)
{
$user = User::findOrFail($id);
Expand Down
8 changes: 0 additions & 8 deletions app/Jobs/RemoveBeatmapsetBestScores.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
namespace App\Jobs;

use App\Libraries\Elasticsearch\BoolQuery;
use App\Libraries\Elasticsearch\Es;
use App\Models\Beatmap;
use App\Models\Beatmapset;
use App\Models\Score\Best\Model;
Expand Down Expand Up @@ -57,13 +56,6 @@ public function handle()
$query->filter(['terms' => ['beatmap_id' => $beatmapIds]]);
$query->filter(['range' => ['score_id' => ['lte' => $this->maxScoreIds[$mode]]]]);

// TODO: do something with response?
Es::getClient('scores')->deleteByQuery([
'index' => $GLOBALS['cfg']['osu']['elasticsearch']['prefix']."high_scores_{$mode}",
'body' => ['query' => $query->toArray()],
'client' => ['ignore' => 404],
]);

$class = Model::getClass($mode);
// Just delete until no more matching rows.
$query = $class
Expand Down
116 changes: 0 additions & 116 deletions app/Libraries/UserBestScoresCheck.php

This file was deleted.

3 changes: 0 additions & 3 deletions config/elasticsearch.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@
'default' => array_merge($defaults, [
'hosts' => $parseHosts('ES_HOST'),
]),
'scores' => array_merge($defaults, [
'hosts' => $parseHosts('ES_SCORES_HOST'),
]),
'solo_scores' => array_merge($defaults, [
'hosts' => $parseHosts('ES_SOLO_SCORES_HOST'),
]),
Expand Down
1 change: 0 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ x-env: &x-env
DB_CONNECTION_STRING: Server=db;Database=osu;Uid=osuweb;
DB_HOST: db
ES_HOST: http://elasticsearch:9200
ES_SCORES_HOST: http://elasticsearch:9200
ES_SOLO_SCORES_HOST: http://elasticsearch:9200
GITHUB_TOKEN: "${GITHUB_TOKEN}"
NOTIFICATION_REDIS_HOST: redis
Expand Down
9 changes: 5 additions & 4 deletions resources/css/bem/comment-editor.less
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
@_spacing: 10px;
@_border-radius: @border-radius-large;

--bg: hsl(var(--hsl-b3));
border-radius: @_border-radius;
display: flex;
flex-direction: column;
background-color: @osu-colour-b3;
border: 2px solid @osu-colour-b3;
background: var(--bg);
position: relative;

&--fancy {
Expand Down Expand Up @@ -62,14 +62,15 @@
padding: @_spacing;
font-size: @font-size--phone-input;
border-radius: @_border-radius @_border-radius 0 0;
resize: none;
border: 2px solid var(--bg);
border-bottom: none;
background-color: @osu-colour-b5;
resize: none;

@media @desktop {
font-size: inherit;
}

color: white;
&::placeholder {
color: @osu-colour-f1;
}
Expand Down
13 changes: 7 additions & 6 deletions resources/css/colors.less
Original file line number Diff line number Diff line change
Expand Up @@ -203,9 +203,10 @@ body {

@group-colour-default: #0087ca;

@colour-rank-d: #ff5858;
@colour-rank-c: #ea7948;
@colour-rank-b: #d99d03;
@colour-rank-a: #72c904;
@colour-rank-s: #0096a2;
@colour-rank-ss: #be0089;
// cross-reference: https://github.com/ppy/osu/blob/b658d9a681a04101900d5ce6c5b84d56320e08e7/osu.Game/Graphics/OsuColour.cs#L42-L73
@colour-rank-d: #ff5a5a;
@colour-rank-c: #ff8e5d;
@colour-rank-b: #e3b130;
@colour-rank-a: #88da20;
@colour-rank-s: #02b5c3;
@colour-rank-ss: #de31ae;
23 changes: 15 additions & 8 deletions resources/js/beatmapsets-show/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,19 @@ import Stats from './stats';

const favouritesToShow = 50;

function statusIcon(type: 'storyboard' | 'video') {
const iconClass = type === 'video' ? 'fas fa-film' : 'fas fa-image';

return (
<div
className='beatmapset-status beatmapset-status--show-icon'
title={trans(`beatmapsets.show.info.${type}`)}
>
<span className={iconClass} />
</div>
);
}

interface DownloadButtonOptions {
bottomTextKey?: string;
href: string;
Expand Down Expand Up @@ -352,14 +365,8 @@ export default class Header extends React.Component<Props> {
private renderStatusBar() {
return (
<div className='beatmapset-header__status'>
{this.controller.beatmapset.storyboard &&
<div
className='beatmapset-status beatmapset-status--show-icon'
title={trans('beatmapsets.show.info.storyboard')}
>
<span className='fas fa-image' />
</div>
}
{this.controller.beatmapset.video && statusIcon('video')}
{this.controller.beatmapset.storyboard && statusIcon('storyboard')}
<a className='beatmapset-status beatmapset-status--show' href={this.statusToWikiLink(this.controller.currentBeatmap.status)}>
{trans(`beatmapsets.show.status.${this.controller.currentBeatmap.status}`)}
</a>
Expand Down
41 changes: 2 additions & 39 deletions resources/js/scores-show/dial.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@

import * as d3 from 'd3';
import Rank from 'interfaces/rank';
import Ruleset from 'interfaces/ruleset';
import * as React from 'react';

interface Props {
accuracy: number;
mode: Ruleset;
rank: Rank;
rankCutoffs: number[];
}

const displayRank: Record<Rank, string> = {
Expand All @@ -24,46 +23,10 @@ const displayRank: Record<Rank, string> = {
XH: 'SS',
};

const refDataMap: Record<Ruleset, number[]> = {
// <rank>: minimum acc => (higher rank acc - current acc)
// for SS, use minimum accuracy of 0.99 (any less and it's too small)
// actual array is reversed as it's rendered from D to SS clockwise

// SS: 0.99 => 0.01
// S: 0.9801 => 0.0099
// A: 0.9401 => 0.04
// B: 0.9001 => 0.04
// C: 0.8501 => 0.05
// D: 0 => 0.8501
fruits: [0.8501, 0.05, 0.04, 0.04, 0.0099, 0.01],
// SS: 0.99 => 0.01
// S: 0.95 => 0.04
// A: 0.9 => 0.05
// B: 0.8 => 0.1
// C: 0.7 => 0.1
// D: 0 => 0.7
mania: [0.7, 0.1, 0.1, 0.05, 0.04, 0.01],
// SS: 0.99 => 0.01
// S: (0.9 * 300 + 0.1 * 100) / 300 = 0.933 => 0.057
// A: (0.8 * 300 + 0.2 * 100) / 300 = 0.867 => 0.066
// B: (0.7 * 300 + 0.3 * 100) / 300 = 0.8 => 0.067
// C: 0.6 => 0.2
// D: 0 => 0.6
osu: [0.6, 0.2, 0.067, 0.066, 0.057, 0.01],
// SS: 0.99 => 0.01
// S: (0.9 * 300 + 0.1 * 50) / 300 = 0.917 => 0.073
// A: (0.8 * 300 + 0.2 * 50) / 300 = 0.833 => 0.084
// B: (0.7 * 300 + 0.3 * 50) / 300 = 0.75 => 0.083
// C: 0.6 => 0.15
// D: 0 => 0.6
taiko: [0.6, 0.15, 0.083, 0.084, 0.073, 0.01],
};

export default function Dial(props: Props) {
const arc = d3.arc();
const pie = d3.pie().sortValues(null);
const valueData = [props.accuracy, 1 - props.accuracy];
const refData = refDataMap[props.mode];

return (
<div className='score-dial'>
Expand All @@ -76,7 +39,7 @@ export default function Dial(props: Props) {
</linearGradient>
</defs>
<g transform='translate(100, 100)'>
{pie(refData).map((d) => (
{pie(props.rankCutoffs).map((d) => (
<path
key={d.index}
className={`score-dial__inner score-dial__inner--${d.index}`}
Expand Down
5 changes: 2 additions & 3 deletions resources/js/scores-show/info.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
import BeatmapsetCover from 'components/beatmapset-cover';
import { SoloScoreJsonForShow } from 'interfaces/solo-score-json';
import * as React from 'react';
import { rulesetName } from 'utils/beatmap-helper';
import { accuracy, rank } from 'utils/score-helper';
import { accuracy, rank, rankCutoffs } from 'utils/score-helper';
import Buttons from './buttons';
import Dial from './dial';
import Player from './player';
Expand All @@ -27,7 +26,7 @@ export default function Info({ score }: Props) {
</div>

<div className='score-info__item score-info__item--dial'>
<Dial accuracy={accuracy(score)} mode={rulesetName(score.ruleset_id)} rank={rank(score)} />
<Dial accuracy={accuracy(score)} rank={rank(score)} rankCutoffs={rankCutoffs(score)} />
</div>

<div className='score-info__item score-info__item--player'>
Expand Down
Loading

0 comments on commit d489d96

Please sign in to comment.