Skip to content

Commit

Permalink
repurpose dead ratingovertime function
Browse files Browse the repository at this point in the history
  • Loading branch information
MinaciousGrace committed Jul 19, 2018
1 parent 010320f commit 919ab7f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 44 deletions.
1 change: 0 additions & 1 deletion src/Profile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -942,7 +942,6 @@ void Profile::CalculateStatsFromScores(LoadingWindow* ld) {

SCOREMAN->RecalculateSSRs(ld, m_sProfileID);
SCOREMAN->CalcPlayerRating(m_fPlayerRating, m_fPlayerSkillsets, m_sProfileID);
//SCOREMAN->RatingOverTime();
}

void Profile::CalculateStatsFromScores() {
Expand Down
46 changes: 4 additions & 42 deletions src/ScoreManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,48 +113,10 @@ void ScoreManager::PurgeProfileScores(const string& profileID) {
pscores[profileID].clear();
}

void ScoreManager::RatingOverTime(const string& profileID) {
auto compdate = [](HighScore* a, HighScore* b) { return (a->GetDateTime() < b->GetDateTime()); };

auto& scores = AllProfileScores[profileID];

vector<bool> wasvalid;
sort(scores.begin(), scores.end(), compdate);

for (auto& n : scores) {
wasvalid.push_back(n->GetEtternaValid());
n->SetEtternaValid(false);
}

float doot = 10.f;
float doot2[8];
LOG->Warn("wer");
if (scores.empty())
return;

DateTime lastvalidday = AllProfileScores[profileID].front()->GetDateTime();
lastvalidday.StripTime();

CalcPlayerRating(doot, doot2, profileID);
LOG->Warn(lastvalidday.GetString());

DateTime finalvalidday = scores.back()->GetDateTime();
finalvalidday.StripTime();
while (lastvalidday != finalvalidday) {
for (auto& n : scores) {
DateTime date = n->GetDateTime();
date.StripTime();

if (lastvalidday < date) {
lastvalidday = date;
break;
}

n->SetEtternaValid(true);
}
CalcPlayerRating(doot, doot2, profileID);
LOG->Trace("%f", doot);
}
void ScoreManager::RatingOverTime() {
if (false)
for (auto *s : AllScores)
s->GenerateValidationKeys();
}

ScoresForChart::ScoresForChart() {
Expand Down
2 changes: 1 addition & 1 deletion src/ScoreManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ class ScoreManager

bool KeyHasScores(const string& ck, const string& profileID = PROFILEMAN->GetProfile(PLAYER_1)->m_sProfileID) { return pscores[profileID].count(ck) == 1; }
bool HasAnyScores() { return !AllScores.empty(); }
void RatingOverTime(const string& profileID);
void RatingOverTime();

XNode *CreateNode(const string& profileID = PROFILEMAN->GetProfile(PLAYER_1)->m_sProfileID) const;
void LoadFromNode(const XNode* node, const string& profileID = PROFILEMAN->GetProfile(PLAYER_1)->m_sProfileID);
Expand Down

0 comments on commit 919ab7f

Please sign in to comment.