public UpdateScore(CpScore cpScore, long timeStamp):this(timeStamp) { TimeStamp = timeStamp.ToString(); ResistanceScore = cpScore.ResistanceScore; EnlightenedScore = cpScore.EnlightenedScore; Kudos = cpScore.Kudos; }
public RecordedScore(CpScore cpScore, CycleIdentifier cycleIdentifier, int cp) : base(cycleIdentifier, cp) { ResistanceScore = cpScore.ResistanceScore; EnlightenedScore = cpScore.EnlightenedScore; Kudos = cpScore.Kudos; }
private void SetEnlightenedScore(int cp, int enlightenedScore) { CpScore cpScore; if (!_scores.TryGetValue(cp, out cpScore)) { cpScore = new CpScore(0, enlightenedScore); _scores.Add(cp, cpScore); return; } cpScore.EnlightenedScore = enlightenedScore; }
private void SetResistanceScore(int cp, int resistanceScore) { CpScore cpScore; if (!_scores.TryGetValue(cp, out cpScore)) { cpScore = new CpScore(resistanceScore, 0); _scores.Add(cp, cpScore); return; } cpScore.ResistanceScore = resistanceScore; }
public bool UpdateScore(CycleIdentifier cycle, int checkpoint, long timestampTicks, CpScore cpScore) { var scoreEntity = _cycleScoresCache[cycle.Id]; if (scoreEntity.Timestamp.Ticks != timestampTicks)//final check before we overwrite something we didn't mean to { return(false); } scoreEntity.SaveScores(checkpoint, cpScore); //this does update scoreEntity.TimeStamp _cloudTable.Execute(scoreEntity.Timestamp == DateTimeOffset.MinValue ? TableOperation.Insert(scoreEntity) : TableOperation.Replace(scoreEntity)); //should we check the _cloudTable.Execute().HttpStatusCode ?? return(true); //what is the new TimeStamp?? //else it's not the right timestamp }
public bool UpdateScore(CycleIdentifier cycle, int checkpoint, long timestampTicks, CpScore cpScore) { if (_timeStamps[cycle.Id] == timestampTicks) { //shouldn't need to update _cycleScores since the CycleScore is updated elsewhere. This method is for persisting somewhere _timeStamps[cycle.Id] = DateTimeOffset.Now.Ticks; return(true); } return(false); }
public void SaveScores(int checkpoint, CpScore cpScore) { _scores[checkpoint] = cpScore; }