// Needed for most other team display
        public TeamProfileResult(team t, teammatchup tm)
        {
            this.PriorHandicapForOpponent = 0;
            this.PriorHandicapForPlayer   = 0;
            this.OpponentPoints           = 0;
            this.Points                  = 0;
            this.ScoreDifference         = 0;
            this.OpponentScoreDifference = 0;
            this.Score         = 0;
            this.OpponentScore = 0;

            foreach (match m in tm.matches)
            {
                foreach (result r in m.results)
                {
                    if (r.team.id == t.id)
                    {
                        this.PriorHandicapForPlayer += r.priorHandicap;
                        this.Points          += r.points;
                        this.ScoreDifference += r.ScoreDifference();
                        this.Score           += r.score;
                    }
                    else
                    {
                        this.PriorHandicapForOpponent += r.priorHandicap;
                        this.OpponentPoints           += r.points;
                        this.OpponentScoreDifference  += r.ScoreDifference();
                        this.OpponentScore            += r.score;
                    }
                }
            }

            foreach (team aTeam in tm.teams)
            {
                if (t.id != aTeam.id)
                {
                    this.OpponentName = aTeam.teamName;
                }
            }

            this.WeekIndex  = tm.week.seasonIndex;
            this.WeekDate   = tm.week.date;
            this.TeeTime    = tm.TeeTimeText();
            this.CourseName = tm.week.course.name;
            this.WasWin     = this.Points > 48;
            this.WasLoss    = this.Points < 48;
        }
示例#2
0
        public ScheduleTeamMatchup(teammatchup tm)
        {
            int numOfTeams = tm.teams.Count;

            this.MatchOrder = tm.matchOrder;

            team team1 = numOfTeams > 0 ? tm.teams.First() : null;
            team team2 = numOfTeams > 1 ? tm.teams.Skip(1).First() : null;

            if (team1 != null)
            {
                this.Team1       = TeamResponse.From(team1);
                this.Team1Points = tm.PointsFor(team1);
                this.Team1Win    = tm.Team1Won();
            }

            if (team2 != null)
            {
                this.Team2       = TeamResponse.From(team2);
                this.Team2Points = tm.PointsFor(team2);
                this.Team2Win    = tm.Team2Won();
            }

            this.IsComplete  = tm.IsComplete();
            this.TeeTimeText = tm.TeeTimeText();
            this.Id          = tm.id;
            this.PlayoffType = tm.playoffType;

            if (this.IsComplete && team1 != null && team2 != null)
            {
                result team1PointsResult = tm.TopPoints(team1);
                //result team2PointsResult = tm.TopPoints(team2);

                this.TopPoints = team1PointsResult != null ?
                                 new MatchSummaryValue
                {
                    Player         = new PlayerWebResponse(team1PointsResult.player),
                    FormattedValue = LeaderBoardFormat.Default.FormatValue(team1PointsResult.points),
                    Value          = (double)team1PointsResult.points
                } : null;


                result topNetScore = tm.TopNetDifference(team1);

                this.TopNetScore = topNetScore != null ?
                                   new MatchSummaryValue
                {
                    Player         = new PlayerWebResponse(topNetScore.player),
                    FormattedValue = LeaderBoardFormat.Net.FormatValue(topNetScore.NetScoreDifference()),
                    Value          = (double)topNetScore.NetScoreDifference()
                } : null;

                //this.Team2TopPoints = team2PointsResult != null ?
                //    new MatchSummaryValue
                //    {
                //        Player = new PlayerWebResponse(team2PointsResult.player),
                //        FormattedValue = LeaderBoardFormat.Default.FormatValue(team2PointsResult.points),
                //        Value = (double)team2PointsResult.points
                //    } : null;
            }
        }