Esempio n. 1
0
        public double FractionDone()
        {
            var hasNoScoredEntrants  = !Entrants.Any(x => x.Rank.HasValue && x.Rank > 0);
            var hasAllScoredEntrants = Entrants.All(x => (x.Rank.HasValue && x.Rank > 0) || x.Absent);

            if (!Entrants.Any())
            {
                return(0.0);
            }
            else if (hasNoScoredEntrants && Event_Sess.All(s => s.ActualEnd < DateTime.Now))
            {
                return(0.666);
            }
            else if (hasNoScoredEntrants && Event_Sess.Any(s => s.ActualStart < DateTime.Now))
            {
                return(0.333);
            }
            else if (hasNoScoredEntrants)
            {
                return(0.0);
            }
            else if (hasAllScoredEntrants)
            {
                return(1.0);
            }
            else
            {
                return(0.9);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Event_Sess's are NOT shared, so need to be copied when we copy an Event
        /// </summary>
        /// <param name="evt"></param>
        /// <returns></returns>
        public Event_Sess CopyTo(Event evt)
        {
            var es = new Event_Sess()
            {
                Date      = this.Date,
                EIN       = evt.EIN,
                Event     = evt,
                INDEX     = this.INDEX,
                StartTime = this.StartTime,
                EndTime   = this.EndTime,
                Session   = this.Session,
                Session1  = this.Session1   // Sessions ARE shared
            };

            return(es);
        }
Esempio n. 3
0
        public string Status()
        {
            var hasNoScoredEntrants  = !Entrants.Any(x => x.Rank.HasValue && x.Rank > 0);
            var hasAllScoredEntrants = Entrants.All(x => (x.Rank.HasValue && x.Rank > 0) || x.Absent);

            if (!Entrants.Any())
            {
                if (!End.HasValue || DateTime.Now < End.Value)
                {
                    return("In database, empty");
                }
                else
                {
                    return("Complete"); // noone entered, and the end is passed
                }
            }
            else if (hasNoScoredEntrants && Event_Sess.All(s => s.ActualEnd < DateTime.Now))
            {
                return("Awaiting results");
            }
            else if (hasNoScoredEntrants && Event_Sess.Any(s => s.ActualStart < DateTime.Now))
            {
                return("In progress");
            }
            else if (hasNoScoredEntrants)
            {
                return("Taking entries");
            }
            else if (hasAllScoredEntrants)
            {
                return("Complete");
            }
            else
            {
                return("Results being entered");
            }
        }