20
20
#include < CCDB/BasicCCDBManager.h>
21
21
#include " QualityControl/ObjectMetadataKeys.h"
22
22
23
+ #include < DataFormatsParameters/ECSDataAdapters.h>
24
+ #include < QualityControl/stringUtils.h>
25
+
23
26
using namespace o2 ::quality_control::repository;
24
27
25
28
namespace o2 ::quality_control::core::activity_helpers
@@ -47,7 +50,13 @@ core::Activity asActivity(const std::map<std::string, std::string>& metadata, co
47
50
{
48
51
core::Activity activity;
49
52
if (auto runType = metadata.find (metadata_keys::runType); runType != metadata.end ()) {
50
- activity.mType = runType->second ;
53
+ if (isOnlyDigits (runType->second )) {
54
+ // we probably got the former representation of run types, i.e. an integer. We convert it as best
55
+ // as we can using O2's ECSDataAdapter
56
+ activity.mType = parameters::GRPECS::RunTypeNames[std::stoi (runType->second )];
57
+ } else {
58
+ activity.mType = runType->second ;
59
+ }
51
60
}
52
61
if (auto runNumber = metadata.find (metadata_keys::runNumber); runNumber != metadata.end ()) {
53
62
activity.mId = std::strtol (runNumber->second .c_str (), nullptr , 10 );
@@ -72,7 +81,13 @@ core::Activity asActivity(const boost::property_tree::ptree& tree, const std::st
72
81
{
73
82
core::Activity activity;
74
83
if (auto runType = tree.get_optional <std::string>(metadata_keys::runType); runType.has_value ()) {
75
- activity.mType = runType.value ();
84
+ if (isOnlyDigits (runType.value ())) {
85
+ // we probably got the former representation of run types, i.e. an integer. We convert it as best
86
+ // as we can using O2's ECSDataAdapter
87
+ activity.mType = parameters::GRPECS::RunTypeNames[std::stoi (runType.value ())];
88
+ } else {
89
+ activity.mType = runType.value ();
90
+ }
76
91
}
77
92
if (auto runNumber = tree.get_optional <int >(metadata_keys::runNumber); runNumber.has_value ()) {
78
93
activity.mId = runNumber.value ();
0 commit comments