Fix some code issues from eslint

This commit is contained in:
Jonny 2019-05-29 08:42:12 +02:00
parent 7f28252ae8
commit 38e24a2ec1
10 changed files with 58 additions and 58 deletions

View File

@ -300,10 +300,10 @@ const reducerTournamentStatistics = (state = defaultStateTournamentStatistics, a
return Object.assign({}, state, action.parameters.tournamentInfo); return Object.assign({}, state, action.parameters.tournamentInfo);
case actionTypesTournamentStatistics.REQUEST_TOURNAMENT_STATISTICS_SUCCESS: case actionTypesTournamentStatistics.REQUEST_TOURNAMENT_STATISTICS_SUCCESS:
action.parameters.successCallback(); action.parameters.successCallback();
return Object.assign({}, state, tournamentStatistics); return Object.assign({}, state, action.parameters.tournamentStatistics);
default: return state; default: return state;
} }
} };
const reducerTournamentlist = (state = defaultStateTournamentlist, action) => { const reducerTournamentlist = (state = defaultStateTournamentlist, action) => {
switch (action.type) { switch (action.type) {

View File

@ -7,7 +7,6 @@ import {
} from 'reactstrap'; } from 'reactstrap';
export class DominanceShower extends React.Component { export class DominanceShower extends React.Component {
render() { render() {
return ( return (
<Card className="shadow-sm"> <Card className="shadow-sm">

View File

@ -10,7 +10,6 @@ import {
import {rangedmap} from '../utils/rangedmap'; import {rangedmap} from '../utils/rangedmap';
export class StandingsTable extends React.Component { export class StandingsTable extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
@ -21,7 +20,7 @@ export class StandingsTable extends React.Component {
} }
render() { render() {
let performances = this.props.data.group_phase_performances; const performances = this.props.data.group_phase_performances;
return ( return (
<Card className="shadow-sm"> <Card className="shadow-sm">
@ -38,18 +37,21 @@ export class StandingsTable extends React.Component {
</thead> </thead>
<tbody> <tbody>
{ rangedmap(performances, (team, index) => ( { rangedmap(performances, (team, index) => (
<TeamRow className={(index % 2 === 0)? 'bg-light' : 'bg-white'} key={index} teamToShow={team}/> <TeamRow className={(index % 2 === 0)? 'bg-light' : 'bg-white'}
key={index} teamToShow={team}/>
), 0, 3) } ), 0, 3) }
</tbody> </tbody>
<Collapse isOpen={ this.state.showFullTable } tag="tbody"> <Collapse isOpen={ this.state.showFullTable } tag="tbody">
{ rangedmap(performances, (team, index) => ( { rangedmap(performances, (team, index) => (
<TeamRow className={(index % 2 === 0)? 'bg-light' : 'bg-white'} key={index} teamToShow={team}/> <TeamRow className={(index % 2 === 0)? 'bg-light' : 'bg-white'}
key={index} teamToShow={team}/>
), 3) } ), 3) }
</Collapse> </Collapse>
<tfoot> <tfoot>
<tr> <tr>
<td colSpan='4'> <td colSpan='4'>
<TableButton isFullTableShown={this.state.showFullTable} onToggle={this.toggleShowFullTable}/> <TableButton isFullTableShown={this.state.showFullTable}
onToggle={this.toggleShowFullTable}/>
</td> </td>
</tr> </tr>
</tfoot> </tfoot>
@ -82,7 +84,6 @@ class TeamRow extends React.Component {
} }
class TableButton extends React.Component { class TableButton extends React.Component {
render() { render() {
const {isFullTableShown} = this.props; const {isFullTableShown} = this.props;

View File

@ -12,7 +12,6 @@ import {
class PrivateTournamentInformationView extends React.Component { class PrivateTournamentInformationView extends React.Component {
render() { render() {
const {tournament, isSignedIn, username, currentpage} = this.props; const {tournament, isSignedIn, username, currentpage} = this.props;

View File

@ -61,14 +61,14 @@ export function transformTournamentStatsToStatistics(data) {
}; };
for (let i = 0; i < data.group_scores.length; i++) { for (let i = 0; i < data.group_scores.length; i++) {
let score = data.group_scores[i]; const score = data.group_scores[i];
statistics.group_phase_performances[i] = { statistics.group_phase_performances[i] = {
win_loss_differential: score.group_points, win_loss_differential: score.group_points,
point_differential: score.scored_points - score.received_points, point_differential: score.scored_points - score.received_points,
rank: i + 1, rank: i + 1,
team_name: score.team.name team_name: score.team.name
} };
} }
return statistics; return statistics;

View File

@ -16,7 +16,6 @@ import { Footer } from '../js/components/Footer';
import {requestTournamentStatistics} from '../js/api'; import {requestTournamentStatistics} from '../js/api';
class StatisticsTournamentPage extends React.Component { class StatisticsTournamentPage extends React.Component {
static async getInitialProps({query}) { static async getInitialProps({query}) {
return {query}; return {query};
} }
@ -51,10 +50,12 @@ function StatisticsView(props) {
<Container className="py-5"> <Container className="py-5">
<Row> <Row>
<Col xs="6"> <Col xs="6">
<DominanceShower stats={props.tournamentStatistics.most_dominant_team} title="Stärkstes Team"/> <DominanceShower stats={props.tournamentStatistics.most_dominant_team}
title="Stärkstes Team"/>
</Col> </Col>
<Col xs="6"> <Col xs="6">
<DominanceShower stats={props.tournamentStatistics.least_dominant_team} title="Schwächstes Team"/> <DominanceShower stats={props.tournamentStatistics.least_dominant_team}
title="Schwächstes Team"/>
</Col> </Col>
</Row> </Row>
</Container> </Container>

View File

@ -1,7 +1,7 @@
import Head from 'next/head'; import Head from 'next/head';
import React from 'react'; import React from 'react';
import {connect} from 'react-redux'; import {connect} from 'react-redux';
import {Col, Container, ListGroup, ListGroupItem, Row} from 'reactstrap'; import {Col, Container, Row} from 'reactstrap';
import {ErrorPageComponent} from '../js/components/ErrorComponents'; import {ErrorPageComponent} from '../js/components/ErrorComponents';
import {Footer} from '../js/components/Footer'; import {Footer} from '../js/components/Footer';
@ -19,14 +19,14 @@ import {Match} from '../js/components/Match';
class PrivateTournamentPage extends React.Component { class PrivateTournamentPage extends React.Component {
render() { render() {
const {owner_username, playoffStages} = this.props.tournament; const {ownerUsername, playoffStages} = this.props.tournament;
const {isSignedIn, username} = this.props; const {isSignedIn, username} = this.props;
// TODO: Change href-prop of the anchor tag to contain the tournament code // TODO: Change href-prop of the anchor tag to contain the tournament code
return (<div className='pb-5'> return (<div className='pb-5'>
<TournamentInformationView tournament={this.props.tournament} currentpage='tournament'/> <TournamentInformationView tournament={this.props.tournament} currentpage='tournament'/>
<div className='stages pt-5'> <div className='stages pt-5'>
{playoffStages.map(stage => <Stage isSignedIn={isSignedIn} isOwner={username === owner_username} {playoffStages.map(stage => <Stage isSignedIn={isSignedIn} isOwner={username === ownerUsername}
level={getLevelName(stage.level)} matches={stage.matches} level={getLevelName(stage.level)} matches={stage.matches}
key={stage.level}/>)} key={stage.level}/>)}
</div> </div>
@ -85,7 +85,7 @@ function convertTournament(apiTournament) {
description: apiTournament.description, description: apiTournament.description,
name: apiTournament.name, name: apiTournament.name,
isPublic: apiTournament.public, isPublic: apiTournament.public,
owner_username: apiTournament.owner_username, ownerUsername: apiTournament.owner_username,
groupStage: groupStage, groupStage: groupStage,
playoffStages: playoffStages playoffStages: playoffStages
}; };

View File

@ -3291,7 +3291,7 @@ eslint-visitor-keys@^1.0.0:
resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz#3f3180fb2e291017716acb4c9d6d5b5c34a6a81d" resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz#3f3180fb2e291017716acb4c9d6d5b5c34a6a81d"
integrity sha512-qzm/XxIbxm/FHyH341ZrbnMUpe+5Bocte9xkmFMzPMjRaZMcXww+MpBptFvtU+79L362nqiLhekCxCxDPaUMBQ== integrity sha512-qzm/XxIbxm/FHyH341ZrbnMUpe+5Bocte9xkmFMzPMjRaZMcXww+MpBptFvtU+79L362nqiLhekCxCxDPaUMBQ==
eslint@^5.9.0: eslint@^5.16.0:
version "5.16.0" version "5.16.0"
resolved "https://registry.yarnpkg.com/eslint/-/eslint-5.16.0.tgz#a1e3ac1aae4a3fbd8296fcf8f7ab7314cbb6abea" resolved "https://registry.yarnpkg.com/eslint/-/eslint-5.16.0.tgz#a1e3ac1aae4a3fbd8296fcf8f7ab7314cbb6abea"
integrity sha512-S3Rz11i7c8AA5JPv7xAH+dOyq/Cu/VXHiHXBPOU1k/JAM5dXqQPt3qcrhpHSorXmrpu2g0gkIBVXAqCpzfoZIg== integrity sha512-S3Rz11i7c8AA5JPv7xAH+dOyq/Cu/VXHiHXBPOU1k/JAM5dXqQPt3qcrhpHSorXmrpu2g0gkIBVXAqCpzfoZIg==