Skip to content

Commit 45abc5a

Browse files
committed
fixed missing end event length calculation
1 parent 92616a7 commit 45abc5a

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

source/gameanalytics/GAEvents.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -665,7 +665,6 @@ namespace gameanalytics
665665
GAEvents::addDimensionsToEvent(ev);
666666

667667
json cleanedFields = state::GAState::getValidatedCustomFields();
668-
669668
GAEvents::addCustomFieldsToEvent(ev, cleanedFields);
670669

671670
std::string jsonDefaults = ev.dump();
@@ -679,11 +678,11 @@ namespace gameanalytics
679678
}
680679
catch(json::exception const& e)
681680
{
682-
logging::GALogger::e("Failed to parse json: %s", e.what());
681+
logging::GALogger::e("updateSessionTime - Failed to parse json: %s", e.what());
683682
}
684683
catch(std::exception const& e)
685684
{
686-
logging::GALogger::e("Exception thrown: %s", e.what());
685+
logging::GALogger::e("updateSessionTime - Exception thrown: %s", e.what());
687686
}
688687
}
689688
}
@@ -725,7 +724,7 @@ namespace gameanalytics
725724
json sessionEndEvent = json::parse(session["event"].get<std::string>());
726725

727726
int64_t event_ts = utilities::getOptionalValue<int64_t>(sessionEndEvent, "client_ts", 0);
728-
int64_t start_ts = std::stoll(utilities::getOptionalValue<std::string>(sessionEndEvent, "timestamp", "0"));
727+
int64_t start_ts = std::stoll(utilities::getOptionalValue<std::string>(session, "timestamp", "0"));
729728

730729
int64_t length = event_ts - start_ts;
731730
length = static_cast<int64_t>(fmax(length, 0));
@@ -745,7 +744,7 @@ namespace gameanalytics
745744
}
746745
catch(std::exception const& e)
747746
{
748-
logging::GALogger::e("Exception thrown: %s", e.what());
747+
logging::GALogger::e("fixMissingSessionEndEvents - Exception thrown: %s", e.what());
749748
}
750749
}
751750
}

0 commit comments

Comments
 (0)