| Conditions | 2 |
| Total Lines | 70 |
| Code Lines | 67 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | import React from "react" |
||
| 137 | renderTeamSquadStats = () => { |
||
| 138 | if (this.state.loading === false && this.state.data) { |
||
| 139 | const { squadPlayerStatistics } = this.state.data |
||
| 140 | |||
| 141 | squadPlayerStatistics.sort((a, b) => b.minutes - a.minutes) |
||
| 142 | |||
| 143 | return ( |
||
| 144 | <Card className="team_stats__players" title="Spelers" hasTable={true}> |
||
| 145 | <table> |
||
| 146 | <thead> |
||
| 147 | <tr> |
||
| 148 | <th className={`table__column__string`}>Speler</th> |
||
| 149 | <th className={`table__column__number show-for-medium`}> |
||
| 150 | <span title="Wedstrijden gespeeld">P</span> |
||
| 151 | </th> |
||
| 152 | <th className={`table__column__number`}> |
||
| 153 | <span title="Wedstrijden gewonnen">W</span> |
||
| 154 | </th> |
||
| 155 | <th className={`table__column__number`}> |
||
| 156 | <span title="Wedstrijden gelijkgespeeld">D</span> |
||
| 157 | </th> |
||
| 158 | <th className={`table__column__number`}> |
||
| 159 | <span title="Wedstrijden verloren">L</span> |
||
| 160 | </th> |
||
| 161 | <th className={`table__column__number`}> |
||
| 162 | <img src={iconCardYellow} title="Gele kaart" alt="Gele kaart" className="table__header__icon" /> |
||
| 163 | </th> |
||
| 164 | <th className={`table__column__number`}> |
||
| 165 | <img src={iconCardRed} title="Rode kaart" alt="Rode kaart" className="table__header__icon" /> |
||
| 166 | </th> |
||
| 167 | <th className={`table__column__number`}> |
||
| 168 | <img |
||
| 169 | src={iconGoal} |
||
| 170 | title="Doelpunt(en) gescoord" |
||
| 171 | alt="Doelpunt(en) gescoord" |
||
| 172 | className="table__header__icon" |
||
| 173 | /> |
||
| 174 | </th> |
||
| 175 | <th className={`table__column__number show-for-medium`}> |
||
| 176 | <img src={iconCleansheet} title="Cleansheets" alt="Cleansheets" className="table__header__icon" /> |
||
| 177 | </th> |
||
| 178 | <th className={`table__column__number`}> |
||
| 179 | <span title="Minuten gespeeld"> |
||
| 180 | <Icon icon="fa-clock-o" /> |
||
| 181 | </span> |
||
| 182 | </th> |
||
| 183 | </tr> |
||
| 184 | </thead> |
||
| 185 | <tbody> |
||
| 186 | {squadPlayerStatistics.map(function (player) { |
||
| 187 | return ( |
||
| 188 | <tr> |
||
| 189 | <td className={`table__column__string`}> |
||
| 190 | {player.firstName} {player.lastName} |
||
| 191 | </td> |
||
| 192 | <td className={`table__column__number show-for-medium`}>{player.gamesPlayed}</td> |
||
| 193 | <td className={`table__column__number`}>{player.gamesWon}</td> |
||
| 194 | <td className={`table__column__number`}>{player.gamesEqual}</td> |
||
| 195 | <td className={`table__column__number`}>{player.gamesLost}</td> |
||
| 196 | <td className={`table__column__number`}>{player.yellowCards}</td> |
||
| 197 | <td className={`table__column__number`}>{player.redCards}</td> |
||
| 198 | <td className={`table__column__number`}>{player.goals}</td> |
||
| 199 | <td className={`table__column__number show-for-medium`}>{player.cleanSheets}</td> |
||
| 200 | <td className={`table__column__number`}>{player.minutes || `0`}'</td> |
||
| 201 | </tr> |
||
| 202 | ) |
||
| 203 | })} |
||
| 204 | </tbody> |
||
| 205 | </table> |
||
| 206 | </Card> |
||
| 207 | ) |
||
| 234 |