Ejemplo n.º 1
0
 /// <summary>
 /// </summary>
 /// <param name="checkpoint"></param>
 /// <param name="updateScore"></param>
 /// <param name="update"></param>
 /// <returns></returns>
 public bool SetScore(int checkpoint, UpdateScore updateScore, ICycleScoreUpdater update)
 {
     var cpScore = new CpScore(updateScore.ResistanceScore.Value, updateScore.EnlightenedScore.Value, updateScore.Kudos);
     _scores[checkpoint] = cpScore;
     //this persists it
     return update.UpdateScore(Cycle, checkpoint, updateScore.ConvertTimeStamp(), cpScore);
 }
Ejemplo n.º 2
0
        /// <summary>
        ///     return reason not updatable
        /// </summary>
        /// <param name="cpScore"></param>
        /// <param name="checkpoint"></param>
        /// <returns></returns>
        public string IsUpdatable(UpdateScore cpScore, int checkpoint)
        {
            //DO NOT CHANGE
            if (checkpoint > _maxCheckPoint)
            {
                //only check this if the cycle is the same, else it's probably a previous cycle? Add some testing to explore this.
                return "Cannot set a checkpoint that is in the future";
            }
            if (HasExactScore(checkpoint,cpScore))
            {
                return "has exact score";
            }

            if (cpScore.ConvertTimeStamp() != _timestampTicks)
            {
                return "timestamp invalid";
            }
            return null;
        }