Fixed blank duel stats bar in single player, oops. Handling getTwoGames from non-logged-in users.

This commit is contained in:
Nick Winter 2015-08-28 10:44:56 -07:00
parent 066d6e7fc1
commit d412a7d5ee
3 changed files with 5 additions and 3 deletions
app
styles/play/level
views/play/level
server/queues/scoring

View file

@ -15,7 +15,8 @@
width: 500px
height: 60px
display: flex
display: none
//display: flex // set if present
flex-direction: row
&:hover

View file

@ -49,6 +49,7 @@ module.exports = class DuelStatsView extends CocoView
super()
for player in @players
@buildAvatar player.heroID, player.team
@$el.css 'display', 'flex' # Show it
buildAvatar: (heroID, team) ->
@avatars ?= {}

View file

@ -37,8 +37,8 @@ getRandomSessions = (user, callback) ->
# Determine whether to play a random match, an internal league match, or an external league match.
# Only people in a league will end up simulating internal league matches (for leagues they're in) except by dumb chance.
# If we don't like that, we can rework sampleByLevel to have an opportunity to switch to internal leagues if the first session had a league affiliation.
leagueIDs = user.get('clans') or []
#leagueIDs = leagueIDs.concat user.get('courseInstances') or []
leagueIDs = user?.get('clans') or []
#leagueIDs = leagueIDs.concat user?.get('courseInstances') or []
leagueIDs = (leagueID + '' for leagueID in leagueIDs) # Make sure to fetch them as strings.
return sampleByLevel callback unless leagueIDs.length and Math.random() > 1 / leagueIDs.length
leagueID = _.sample leagueIDs