Skip to content

Commit f532998

Browse files
committed
Inactive players can now be added via ID from the home page
1 parent d63b69a commit f532998

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ A preview of major changes can be found in the Wiki ([Latest Changes](https://gi
66
- Option to see `All` or `Unique` tournament statistics per player
77
- Ability to "Remote Start" matches on a selected venue
88
- Split tournaments into "Tournaments" and "Seasons"
9+
- Inactive players can now be added via ID from the home page
910

1011
#### Changed
1112
- Updated to latest version of dependencies

routes/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const screensaverTemplate = template.load(require.resolve('../src/pages/screensa
1414
/* GET home page. */
1515
router.get('/', function (req, res, next) {
1616
axios.all([
17-
axios.get(`${req.app.locals.kcapp.api}/player/active`),
17+
axios.get(`${req.app.locals.kcapp.api}/player`),
1818
axios.get(`${req.app.locals.kcapp.api}/match/modes`),
1919
axios.get(`${req.app.locals.kcapp.api}/owetype`),
2020
axios.get(`${req.app.locals.kcapp.api}/match/types`),

src/pages/index/components/new-game-form/new-game-form.component.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ module.exports = {
1010
onCreate(input) {
1111
this.state = {
1212
selected: [],
13-
players: _.reject(input.players, (player) => { return player.is_bot; }),
13+
players: _.reject(input.players, (player) => { return player.is_bot || !player.is_active; }),
1414
input: input,
1515
officeId: 0,
1616
venues: input.venues,
@@ -186,18 +186,19 @@ module.exports = {
186186
}
187187
this.state.playerId = '';
188188

189-
let player = _.find(this.state.players, function (player) {
190-
return player.id == playerId;
191-
});
189+
let player = _.find(this.state.players, (player) => player.id == playerId);
192190
if (player) {
193191
// Player is not already added, so add it
194192
this.addPlayer(null, { input: { player: player } });
195193
} else {
196194
// Player is already added, so remove it
197-
player = _.find(this.state.selected, function (player) {
198-
return player.id == playerId;
199-
});
195+
player = _.find(this.state.selected, (player) => player.id == playerId);
200196
if (!player) {
197+
// Check all players, since it could be a inactive player
198+
let player = _.find(this.input.players, (player) => player.id == playerId);
199+
if (player) {
200+
this.addPlayer(null, { input: { player: player } });
201+
}
201202
return;
202203
}
203204
this.removePlayer(null, { input: { player: player } });

0 commit comments

Comments
 (0)