Skip to content
This repository has been archived by the owner on Jul 17, 2020. It is now read-only.

Manually adding player does not show list of teams #81

Open
makkoli opened this issue Mar 7, 2018 · 2 comments
Open

Manually adding player does not show list of teams #81

makkoli opened this issue Mar 7, 2018 · 2 comments

Comments

@makkoli
Copy link
Contributor

makkoli commented Mar 7, 2018

Players tab > Manually adding a new player

The team dropdown is supposed to have a list of all the teams, but nothing is displayed.

@BenHagan
Copy link
Contributor

BenHagan commented Mar 10, 2018

This getCurrTeams selector reduces the teams returned to the component to only those that are a part of an active season:

const getCurrTeams = createSelector(
[getTeams, getSeasons],
(teams, seasons) => {
let activeSeasons = {};
seasons.forEach(season => {
if (season.active) {
season.teams.forEach(team => {
activeSeasons[team] = season._id;
});
}
});
return teams.reduce((arr, team) => {
if (activeSeasons[team._id]) {
team.seasonId = activeSeasons[team._id];
arr.push(team);
}
return arr;
}, []);
}
);

If you create a season, then add your team to it, the team dropdown includes the team as expected.

If we agree that this is reasonable behavior, maybe the best thing to do would be to add an error to the form if the teams prop is null explaining that you have to have a team and that team has to be in an active season.

@afranco07
Copy link
Contributor

I agree with Ben and his solution. The team must be active and also part of a season to get it to show up in the drop down list.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants