1
0
mirror of synced 2024-11-24 06:20:12 +01:00

Tweak SDVX to match other frontends, add note statistics, fix a few things here and there across all games.

This commit is contained in:
Jennifer Taylor 2022-10-08 18:24:15 +00:00
parent 21fb210439
commit c4d5a6032a
19 changed files with 214 additions and 166 deletions

View File

@ -114,7 +114,7 @@ class DDRFrontend(FrontendBase):
def format_score(self, userid: UserID, score: Score) -> Dict[str, Any]: def format_score(self, userid: UserID, score: Score) -> Dict[str, Any]:
formatted_score = super().format_score(userid, score) formatted_score = super().format_score(userid, score)
formatted_score['combo'] = score.data.get_int('combo') formatted_score['combo'] = score.data.get_int('combo', -1)
formatted_score['lamp'] = score.data.get_int('halo') formatted_score['lamp'] = score.data.get_int('halo')
formatted_score['halo'] = { formatted_score['halo'] = {
DDRBase.HALO_NONE: None, DDRBase.HALO_NONE: None,
@ -146,7 +146,7 @@ class DDRFrontend(FrontendBase):
def format_attempt(self, userid: UserID, attempt: Attempt) -> Dict[str, Any]: def format_attempt(self, userid: UserID, attempt: Attempt) -> Dict[str, Any]:
formatted_attempt = super().format_attempt(userid, attempt) formatted_attempt = super().format_attempt(userid, attempt)
formatted_attempt['combo'] = attempt.data.get_int('combo') formatted_attempt['combo'] = attempt.data.get_int('combo', -1)
formatted_attempt['halo'] = { formatted_attempt['halo'] = {
DDRBase.HALO_NONE: None, DDRBase.HALO_NONE: None,
DDRBase.HALO_GOOD_FULL_COMBO: "GOOD FULL COMBO", DDRBase.HALO_GOOD_FULL_COMBO: "GOOD FULL COMBO",

View File

@ -109,7 +109,6 @@ class JubeatFrontend(FrontendBase):
JubeatBase.PLAY_MEDAL_NEARLY_EXCELLENT: "NEARLY EXCELLENT", JubeatBase.PLAY_MEDAL_NEARLY_EXCELLENT: "NEARLY EXCELLENT",
JubeatBase.PLAY_MEDAL_EXCELLENT: "EXCELLENT", JubeatBase.PLAY_MEDAL_EXCELLENT: "EXCELLENT",
}.get(score.data.get_int('medal'), 'NO PLAY') }.get(score.data.get_int('medal'), 'NO PLAY')
formatted_score['music_rate'] = score.data.get_int('music_rate', 0) / 10
formatted_score['clear_cnt'] = score.data.get_int('clear_count', 0) formatted_score['clear_cnt'] = score.data.get_int('clear_count', 0)
formatted_score['stats'] = score.data.get_dict('stats') formatted_score['stats'] = score.data.get_dict('stats')
return formatted_score return formatted_score
@ -129,7 +128,6 @@ class JubeatFrontend(FrontendBase):
JubeatBase.PLAY_MEDAL_NEARLY_EXCELLENT: "NEARLY EXCELLENT", JubeatBase.PLAY_MEDAL_NEARLY_EXCELLENT: "NEARLY EXCELLENT",
JubeatBase.PLAY_MEDAL_EXCELLENT: "EXCELLENT", JubeatBase.PLAY_MEDAL_EXCELLENT: "EXCELLENT",
}.get(attempt.data.get_int('medal'), 'NO PLAY') }.get(attempt.data.get_int('medal'), 'NO PLAY')
formatted_attempt['music_rate'] = attempt.data.get_int('music_rate', 0) / 10
formatted_attempt['stats'] = attempt.data.get_dict('stats') formatted_attempt['stats'] = attempt.data.get_dict('stats')
return formatted_attempt return formatted_attempt

View File

@ -35,7 +35,7 @@ class SoundVoltexFrontend(FrontendBase):
formatted_score = super().format_score(userid, score) formatted_score = super().format_score(userid, score)
formatted_score['combo'] = score.data.get_int('combo', -1) formatted_score['combo'] = score.data.get_int('combo', -1)
formatted_score['grade'] = { formatted_score['grade'] = {
SoundVoltexBase.GRADE_NO_PLAY: 'No Play', SoundVoltexBase.GRADE_NO_PLAY: '-',
SoundVoltexBase.GRADE_D: 'D', SoundVoltexBase.GRADE_D: 'D',
SoundVoltexBase.GRADE_C: 'C', SoundVoltexBase.GRADE_C: 'C',
SoundVoltexBase.GRADE_B: 'B', SoundVoltexBase.GRADE_B: 'B',
@ -48,21 +48,22 @@ class SoundVoltexFrontend(FrontendBase):
SoundVoltexBase.GRADE_S: 'S', SoundVoltexBase.GRADE_S: 'S',
}.get(score.data.get_int('grade'), 'No Play') }.get(score.data.get_int('grade'), 'No Play')
formatted_score['clear_type'] = { formatted_score['clear_type'] = {
SoundVoltexBase.CLEAR_TYPE_NO_PLAY: 'No Play', SoundVoltexBase.CLEAR_TYPE_NO_PLAY: 'NO PLAY',
SoundVoltexBase.CLEAR_TYPE_FAILED: 'Failed', SoundVoltexBase.CLEAR_TYPE_FAILED: 'FAILED',
SoundVoltexBase.CLEAR_TYPE_CLEAR: 'Cleared', SoundVoltexBase.CLEAR_TYPE_CLEAR: 'CLEARED',
SoundVoltexBase.CLEAR_TYPE_HARD_CLEAR: 'Hard Cleared', SoundVoltexBase.CLEAR_TYPE_HARD_CLEAR: 'HARD CLEARED',
SoundVoltexBase.CLEAR_TYPE_ULTIMATE_CHAIN: 'Ultimate Chain', SoundVoltexBase.CLEAR_TYPE_ULTIMATE_CHAIN: 'ULTIMATE CHAIN',
SoundVoltexBase.CLEAR_TYPE_PERFECT_ULTIMATE_CHAIN: 'Perfect Ultimate Chain', SoundVoltexBase.CLEAR_TYPE_PERFECT_ULTIMATE_CHAIN: 'PERFECT ULTIMATE CHAIN',
}.get(score.data.get_int('clear_type'), 'Failed') }.get(score.data.get_int('clear_type'), 'FAILED')
formatted_score['medal'] = score.data.get_int('clear_type') formatted_score['medal'] = score.data.get_int('clear_type')
formatted_score['stats'] = score.data.get_dict('stats')
return formatted_score return formatted_score
def format_attempt(self, userid: UserID, attempt: Attempt) -> Dict[str, Any]: def format_attempt(self, userid: UserID, attempt: Attempt) -> Dict[str, Any]:
formatted_attempt = super().format_attempt(userid, attempt) formatted_attempt = super().format_attempt(userid, attempt)
formatted_attempt['combo'] = attempt.data.get_int('combo', -1) formatted_attempt['combo'] = attempt.data.get_int('combo', -1)
formatted_attempt['grade'] = { formatted_attempt['grade'] = {
SoundVoltexBase.GRADE_NO_PLAY: 'No Play', SoundVoltexBase.GRADE_NO_PLAY: '-',
SoundVoltexBase.GRADE_D: 'D', SoundVoltexBase.GRADE_D: 'D',
SoundVoltexBase.GRADE_C: 'C', SoundVoltexBase.GRADE_C: 'C',
SoundVoltexBase.GRADE_B: 'B', SoundVoltexBase.GRADE_B: 'B',
@ -75,14 +76,15 @@ class SoundVoltexFrontend(FrontendBase):
SoundVoltexBase.GRADE_S: 'S', SoundVoltexBase.GRADE_S: 'S',
}.get(attempt.data.get_int('grade'), 'No Play') }.get(attempt.data.get_int('grade'), 'No Play')
formatted_attempt['clear_type'] = { formatted_attempt['clear_type'] = {
SoundVoltexBase.CLEAR_TYPE_NO_PLAY: 'No Play', SoundVoltexBase.CLEAR_TYPE_NO_PLAY: 'NO PLAY',
SoundVoltexBase.CLEAR_TYPE_FAILED: 'Failed', SoundVoltexBase.CLEAR_TYPE_FAILED: 'FAILED',
SoundVoltexBase.CLEAR_TYPE_CLEAR: 'Cleared', SoundVoltexBase.CLEAR_TYPE_CLEAR: 'CLEARED',
SoundVoltexBase.CLEAR_TYPE_HARD_CLEAR: 'Hard Cleared', SoundVoltexBase.CLEAR_TYPE_HARD_CLEAR: 'HARD CLEARED',
SoundVoltexBase.CLEAR_TYPE_ULTIMATE_CHAIN: 'Ultimate Chain', SoundVoltexBase.CLEAR_TYPE_ULTIMATE_CHAIN: 'ULTIMATE CHAIN',
SoundVoltexBase.CLEAR_TYPE_PERFECT_ULTIMATE_CHAIN: 'Perfect Ultimate Chain', SoundVoltexBase.CLEAR_TYPE_PERFECT_ULTIMATE_CHAIN: 'PERFECT ULTIMATE CHAIN',
}.get(attempt.data.get_int('clear_type'), 'Failed') }.get(attempt.data.get_int('clear_type'), 'FAILED')
formatted_attempt['medal'] = attempt.data.get_int('clear_type') formatted_attempt['medal'] = attempt.data.get_int('clear_type')
formatted_attempt['stats'] = attempt.data.get_dict('stats')
return formatted_attempt return formatted_attempt
def format_profile(self, profile: Profile, playstats: ValidatedDict) -> Dict[str, Any]: def format_profile(self, profile: Profile, playstats: ValidatedDict) -> Dict[str, Any]:

View File

@ -32,7 +32,7 @@ var HighScore = React.createClass({
<span className="grade">{this.props.score.rank}</span> <span className="grade">{this.props.score.rank}</span>
<span className="score">{this.props.score.points}</span> <span className="score">{this.props.score.points}</span>
</div> </div>
{ this.props.score.combo > 0 ? { this.props.score.combo >= 0 ?
<div> <div>
<span className="label">Combo</span> <span className="label">Combo</span>
<span className="score">{this.props.score.combo}</span> <span className="score">{this.props.score.combo}</span>

View File

@ -64,7 +64,7 @@ var network_scores = React.createClass({
<span className="grade">{score.rank}</span> <span className="grade">{score.rank}</span>
<span className="score">{score.points}</span> <span className="score">{score.points}</span>
</div> </div>
{ score.combo > 0 ? { score.combo >= 0 ?
<div> <div>
<span className="label">Combo</span> <span className="label">Combo</span>
<span className="score">{score.combo}</span> <span className="score">{score.combo}</span>

View File

@ -196,7 +196,7 @@ var top_scores = React.createClass({
return a.combo - b.combo; return a.combo - b.combo;
}, },
reverse: true, reverse: true,
render: function(topscore) { return topscore.combo > 0 ? topscore.combo : ''; }, render: function(topscore) { return topscore.combo >= 0 ? topscore.combo : '-'; },
}, },
{ {
name: 'Halo', name: 'Halo',

View File

@ -41,9 +41,9 @@ var HighScore = React.createClass({
<span className="label">Combo</span> <span className="label">Combo</span>
<span className="score">{this.props.score.combo < 0 ? '-' : this.props.score.combo}</span> <span className="score">{this.props.score.combo < 0 ? '-' : this.props.score.combo}</span>
</div> </div>
{this.props.score.music_rate > 0 ? <div> {this.props.score.music_rate >= 0 ? <div>
<span className="label">Music Rate</span> <span className="label">Music Rate</span>
<span className="score">{this.props.score.music_rate <= 0 ? '-' : this.props.score.music_rate}%</span> <span className="score">{this.props.score.music_rate}%</span>
</div> : null} </div> : null}
{has_stats ? <div title="perfect / great / good / poor / miss"> {has_stats ? <div title="perfect / great / good / poor / miss">
{this.props.score.stats.perfect} {this.props.score.stats.perfect}

View File

@ -66,7 +66,7 @@ var network_scores = React.createClass({
<span className="score">{score.points}</span> <span className="score">{score.points}</span>
<span className="label">Combo</span> <span className="label">Combo</span>
<span className="score">{score.combo < 0 ? '-' : score.combo}</span> <span className="score">{score.combo < 0 ? '-' : score.combo}</span>
{score.music_rate > 0 ? <span> {score.music_rate >= 0 ? <span>
<span className="label">Music Rate</span> <span className="label">Music Rate</span>
<span className="score">{score.music_rate <= 0 ? '-' : score.music_rate}%</span> <span className="score">{score.music_rate <= 0 ? '-' : score.music_rate}%</span>
</span> : null} </span> : null}

View File

@ -122,7 +122,7 @@ var top_scores = React.createClass({
}, },
{ {
name: 'Combo', name: 'Combo',
render: function(topscore) { return topscore.combo > 0 ? topscore.combo : ''; }, render: function(topscore) { return topscore.combo >= 0 ? topscore.combo : '-'; },
sort: function(a, b) { sort: function(a, b) {
return a.combo - b.combo; return a.combo - b.combo;
}, },
@ -130,7 +130,7 @@ var top_scores = React.createClass({
}, },
{ {
name: 'Music Rate', name: 'Music Rate',
render: function(topscore) { return topscore.music_rate > 0 ? topscore.music_rate + "%" : ''; }, render: function(topscore) { return topscore.music_rate >= 0 ? topscore.music_rate + "%" : '-'; },
sort: function(a, b) { sort: function(a, b) {
return a.music_rate - b.music_rate; return a.music_rate - b.music_rate;
}, },

View File

@ -124,7 +124,7 @@ var top_scores = React.createClass({
}, },
{ {
name: 'Combo', name: 'Combo',
render: function(topscore) { return topscore.combo > 0 ? topscore.combo : '-'; }, render: function(topscore) { return topscore.combo >= 0 ? topscore.combo : '-'; },
sort: function(a, b) { sort: function(a, b) {
return a.combo - b.combo; return a.combo - b.combo;
}, },

View File

@ -118,7 +118,7 @@ var top_scores = React.createClass({
}, },
{ {
name: 'Combo', name: 'Combo',
render: function(topscore) { return topscore.combo > 0 ? topscore.combo : '-'; }, render: function(topscore) { return topscore.combo >= 0 ? topscore.combo : '-'; },
sort: function(a, b) { sort: function(a, b) {
return a.combo - b.combo; return a.combo - b.combo;
}, },

View File

@ -57,9 +57,9 @@ var HighScore = React.createClass({
<span className="score">{this.props.score.points}</span> <span className="score">{this.props.score.points}</span>
<span className="label">M</span> <span className="label">M</span>
<span className="score">{this.props.score.miss_count < 0 ? '-' : this.props.score.miss_count}</span> <span className="score">{this.props.score.miss_count < 0 ? '-' : this.props.score.miss_count}</span>
{this.props.score.combo > 0 ? <span> {this.props.score.combo >= 0 ? <span>
<span className="label">Combo</span> <span className="label">Combo</span>
<span className="score">{this.props.score.combo < 0 ? '-' : this.props.score.combo}</span> <span className="score">{this.props.score.combo}</span>
</span> : null} </span> : null}
</div> </div>
<div> <div>

View File

@ -76,9 +76,9 @@ var network_scores = React.createClass({
<span className="score">{score.points}</span> <span className="score">{score.points}</span>
<span className="label">M</span> <span className="label">M</span>
<span className="score">{score.miss_count < 0 ? '-' : score.miss_count}</span> <span className="score">{score.miss_count < 0 ? '-' : score.miss_count}</span>
{score.combo > 0 ? <span> {score.combo >= 0 ? <span>
<span className="label">Combo</span> <span className="label">Combo</span>
<span className="score">{score.combo < 0 ? '-' : score.combo}</span> <span className="score">{score.combo}</span>
</span> : null} </span> : null}
</div> </div>
<div> <div>

View File

@ -151,7 +151,7 @@ var top_scores = React.createClass({
}, },
{ {
name: 'Combo', name: 'Combo',
render: function(topscore) { return topscore.combo > 0 ? topscore.combo : ''; }, render: function(topscore) { return topscore.combo >= 0 ? topscore.combo : '-'; },
sort: function(a, b) { sort: function(a, b) {
return a.combo - b.combo; return a.combo - b.combo;
}, },
@ -159,7 +159,7 @@ var top_scores = React.createClass({
}, },
{ {
name: 'Miss Count', name: 'Miss Count',
render: function(topscore) { return topscore.miss_count; }, render: function(topscore) { return topscore.miss_count >= 0 ? topscore.miss_count : '-'; },
sort: function(a, b) { sort: function(a, b) {
return a.miss_count - b.miss_count; return a.miss_count - b.miss_count;
}, },

View File

@ -57,7 +57,7 @@ var all_players = React.createClass({
}.bind(this), }.bind(this),
}, },
{ {
name: 'Play Count', name: 'Total Rounds',
render: function(userid) { render: function(userid) {
var player = this.state.players[userid]; var player = this.state.players[userid];
return player.plays; return player.plays;

View File

@ -59,13 +59,13 @@ var profile_view = React.createClass({
</div> </div>
<div className="section"> <div className="section">
<LabelledSection label="User ID">{player.extid}</LabelledSection> <LabelledSection label="User ID">{player.extid}</LabelledSection>
<LabelledSection label="Register Time"> <LabelledSection label="Profile Created">
<Timestamp timestamp={player.first_play_time}/> <Timestamp timestamp={player.first_play_time}/>
</LabelledSection> </LabelledSection>
<LabelledSection label="Last Play Time"> <LabelledSection label="Last Played">
<Timestamp timestamp={player.last_play_time}/> <Timestamp timestamp={player.last_play_time}/>
</LabelledSection> </LabelledSection>
<LabelledSection label="Total Plays"> <LabelledSection label="Total Rounds">
{player.plays} {player.plays}
</LabelledSection> </LabelledSection>
</div> </div>

View File

@ -22,18 +22,28 @@ var HighScore = React.createClass({
if (!this.props.score) { if (!this.props.score) {
return null; return null;
} }
has_stats = (
this.props.score.stats.critical > 0 ||
this.props.score.stats.near > 0 ||
this.props.score.stats.error > 0
);
return ( return (
<div className="score"> <div className="score">
<div> <div>
<span className="grade">{this.props.score.grade}</span>
<span className="label">Score</span> <span className="label">Score</span>
<span className="score">{this.props.score.points}</span> <span className="score">{this.props.score.points}</span>
<span className="status">{this.props.score.grade}</span>
</div>
<div>
<span className="label">Combo</span> <span className="label">Combo</span>
<span className="score">{this.props.score.combo < 0 ? '-' : this.props.score.combo}</span> <span className="score">{this.props.score.combo < 0 ? '-' : this.props.score.combo}</span>
</div> </div>
{has_stats ? <div title="critical / near / error">
{this.props.score.stats.critical}
<span> / </span>
{this.props.score.stats.near}
<span> / </span>
{this.props.score.stats.error}
</div> : null}
<div> <div>
<span className="status">{this.props.score.clear_type}</span> <span className="status">{this.props.score.clear_type}</span>
</div> </div>
@ -201,8 +211,10 @@ var network_records = React.createClass({
if (paginate && curpage != this.state.subtab) { return null; } if (paginate && curpage != this.state.subtab) { return null; }
return ( return (
<tr key={((-songid) - 1).toString()}> <tr key={((-songid) - 1).toString()} className="header">
<td className="subheader">{ this.state.versions[(-songid) - 1] }</td> <td className="subheader">{
!paginate ? this.state.versions[(-songid) - 1] : "Song / Artist / Difficulties"
}</td>
<td className="subheader">Novice</td> <td className="subheader">Novice</td>
<td className="subheader">Advanced</td> <td className="subheader">Advanced</td>
<td className="subheader">Exhaust</td> <td className="subheader">Exhaust</td>
@ -432,118 +444,120 @@ var network_records = React.createClass({
renderBySongIDList: function(songids, showplays) { renderBySongIDList: function(songids, showplays) {
return ( return (
<table className="list records"> <div className="section">
<thead> <table className="list records">
<tr> <thead>
<th className="subheader">Song</th> <tr>
<th className="subheader">Novice</th> <th className="subheader">Song / Artist / Difficulties</th>
<th className="subheader">Advanced</th> <th className="subheader">Novice</th>
<th className="subheader">Exhaust</th> <th className="subheader">Advanced</th>
<th className="subheader">Infinite</th> <th className="subheader">Exhaust</th>
<th className="subheader">Maximum</th> <th className="subheader">Infinite</th>
</tr> <th className="subheader">Maximum</th>
</thead> </tr>
<tbody> </thead>
{songids.map(function(songid, index) { <tbody>
if (index < this.state.offset || index >= this.state.offset + this.state.limit) { {songids.map(function(songid, index) {
return null; if (index < this.state.offset || index >= this.state.offset + this.state.limit) {
} return null;
var records = this.state.records[songid];
if (!records) {
records = {};
}
var plays = this.getPlays(records);
var difficulties = this.state.songs[songid].difficulties;
return (
<tr key={songid.toString()}>
<td className="center">
<div>
<a href={Link.get('individual_score', songid)}>
<div className="songname">{ this.state.songs[songid].name }</div>
<div className="songartist">{ this.state.songs[songid].artist }</div>
</a>
</div>
<div className="songdifficulties">
{this.renderDifficulty(songid, 0)}
<span> / </span>
{this.renderDifficulty(songid, 1)}
<span> / </span>
{this.renderDifficulty(songid, 2)}
<span> / </span>
{this.renderDifficulty(songid, 3)}
<span> / </span>
{this.renderDifficulty(songid, 4)}
</div>
{ showplays ? <div className="songplays">#{index + 1} - {plays}{plays == 1 ? ' play' : ' plays'}</div> : null }
</td>
<td className={difficulties[0] > 0 ? "" : "nochart"}>
<HighScore
players={this.state.players}
songid={songid}
chart={0}
score={records[0]}
/>
</td>
<td className={difficulties[1] > 0 ? "" : "nochart"}>
<HighScore
players={this.state.players}
songid={songid}
chart={1}
score={records[1]}
/>
</td>
<td className={difficulties[2] > 0 ? "" : "nochart"}>
<HighScore
players={this.state.players}
songid={songid}
chart={2}
score={records[2]}
/>
</td>
<td className={difficulties[3] > 0 ? "" : "nochart"}>
<HighScore
players={this.state.players}
songid={songid}
chart={3}
score={records[3]}
/>
</td>
<td className={difficulties[4] > 0 ? "" : "nochart"}>
<HighScore
players={this.state.players}
songid={songid}
chart={4}
score={records[4]}
/>
</td>
</tr>
);
}.bind(this))}
</tbody>
<tfoot>
<tr>
<td colSpan={6}>
{ this.state.offset > 0 ?
<Prev onClick={function(event) {
var page = this.state.offset - this.state.limit;
if (page < 0) { page = 0; }
this.setState({offset: page});
}.bind(this)}/> : null
} }
{ (this.state.offset + this.state.limit) < songids.length ?
<Next style={ {float: 'right'} } onClick={function(event) { var records = this.state.records[songid];
var page = this.state.offset + this.state.limit; if (!records) {
if (page >= songids.length) { return } records = {};
this.setState({offset: page});
}.bind(this)}/> :
null
} }
</td>
</tr> var plays = this.getPlays(records);
</tfoot> var difficulties = this.state.songs[songid].difficulties;
</table> return (
<tr key={songid.toString()}>
<td className="center">
<div>
<a href={Link.get('individual_score', songid)}>
<div className="songname">{ this.state.songs[songid].name }</div>
<div className="songartist">{ this.state.songs[songid].artist }</div>
</a>
</div>
<div className="songdifficulties">
{this.renderDifficulty(songid, 0)}
<span> / </span>
{this.renderDifficulty(songid, 1)}
<span> / </span>
{this.renderDifficulty(songid, 2)}
<span> / </span>
{this.renderDifficulty(songid, 3)}
<span> / </span>
{this.renderDifficulty(songid, 4)}
</div>
{ showplays ? <div className="songplays">#{index + 1} - {plays}{plays == 1 ? ' play' : ' plays'}</div> : null }
</td>
<td className={difficulties[0] > 0 ? "" : "nochart"}>
<HighScore
players={this.state.players}
songid={songid}
chart={0}
score={records[0]}
/>
</td>
<td className={difficulties[1] > 0 ? "" : "nochart"}>
<HighScore
players={this.state.players}
songid={songid}
chart={1}
score={records[1]}
/>
</td>
<td className={difficulties[2] > 0 ? "" : "nochart"}>
<HighScore
players={this.state.players}
songid={songid}
chart={2}
score={records[2]}
/>
</td>
<td className={difficulties[3] > 0 ? "" : "nochart"}>
<HighScore
players={this.state.players}
songid={songid}
chart={3}
score={records[3]}
/>
</td>
<td className={difficulties[4] > 0 ? "" : "nochart"}>
<HighScore
players={this.state.players}
songid={songid}
chart={4}
score={records[4]}
/>
</td>
</tr>
);
}.bind(this))}
</tbody>
<tfoot>
<tr>
<td colSpan={6}>
{ this.state.offset > 0 ?
<Prev onClick={function(event) {
var page = this.state.offset - this.state.limit;
if (page < 0) { page = 0; }
this.setState({offset: page});
}.bind(this)}/> : null
}
{ (this.state.offset + this.state.limit) < songids.length ?
<Next style={ {float: 'right'} } onClick={function(event) {
var page = this.state.offset + this.state.limit;
if (page >= songids.length) { return }
this.setState({offset: page});
}.bind(this)}/> :
null
}
</td>
</tr>
</tfoot>
</table>
</div>
); );
}, },

View File

@ -49,17 +49,29 @@ var network_scores = React.createClass({
}, },
renderScore: function(score) { renderScore: function(score) {
has_stats = (
score.stats.critical > 0 ||
score.stats.near > 0 ||
score.stats.error > 0
);
return ( return (
<div className="score"> <div className="score">
<div> <div>
<span className="grade">{score.grade}</span>
<span className="label">Score</span> <span className="label">Score</span>
<span className="score">{score.points}</span> <span className="score">{score.points}</span>
<span className="status">{score.grade}</span> {score.combo >= 0 ? <span>
<div> <span className="label">Combo</span>
</div> <span className="score">{score.combo}</span>
<span className="label">Combo</span> </span> : null}
<span className="score">{score.combo < 0 ? '-' : score.combo}</span>
</div> </div>
{has_stats ? <div title="critical / near / error">
{score.stats.critical}
<span> / </span>
{score.stats.near}
<span> / </span>
{score.stats.error}
</div> : null}
<div> <div>
<span className="status">{score.clear_type}</span> <span className="status">{score.clear_type}</span>
</div> </div>
@ -75,8 +87,8 @@ var network_scores = React.createClass({
<tr> <tr>
{ window.shownames ? <th>Name</th> : null } { window.shownames ? <th>Name</th> : null }
<th>Timestamp</th> <th>Timestamp</th>
<th>Song</th> <th>Song / Artist</th>
<th>Chart</th> <th>Difficulty</th>
<th>Score</th> <th>Score</th>
</tr> </tr>
</thead> </thead>

View File

@ -87,7 +87,7 @@ var top_scores = React.createClass({
}.bind(this))} }.bind(this))}
</div> </div>
<div className="section"> <div className="section">
<Table <Table
className="list topscores" className="list topscores"
columns={[ columns={[
{ {
@ -100,14 +100,14 @@ var top_scores = React.createClass({
); );
}.bind(this), }.bind(this),
sort: function(a, b) { sort: function(a, b) {
var an = this.state.players[a.userid].name; var an = this.state.players[a.userid].name;
var bn = this.state.players[b.userid].name; var bn = this.state.players[b.userid].name;
return an.localeCompare(bn); return an.localeCompare(bn);
}.bind(this), }.bind(this),
}, },
{ {
name: 'Grade', name: 'Grade',
render: function(topscore) { return topscore.grade; }, render: function(topscore) { return <span className="grade">{topscore.grade}</span>; },
}, },
{ {
name: 'Clear Type', name: 'Clear Type',
@ -123,7 +123,29 @@ var top_scores = React.createClass({
}, },
{ {
name: 'Combo', name: 'Combo',
render: function(topscore) { return topscore.combo > 0 ? topscore.combo : '-'; }, render: function(topscore) { return topscore.combo >= 0 ? topscore.combo : '-'; },
sort: function(a, b) {
return a.combo - b.combo;
},
reverse: true,
},
{
name: 'Judgement Stats',
render: function(topscore) {
console.log(topscore);
has_stats = (
topscore.stats.critical > 0 ||
topscore.stats.near > 0 ||
topscore.stats.error > 0
);
return has_stats ? <div title="critical / near / error">
{topscore.stats.critical}
<span> / </span>
{topscore.stats.near}
<span> / </span>
{topscore.stats.error}
</div> : null;
}
}, },
]} ]}
defaultsort='Score' defaultsort='Score'