Configuration::ParseJson():

Call parseWeekDay() to reading the week-day-settings.
This commit is contained in:
Gerhard Hoffmann 2024-09-02 16:57:11 +02:00
parent c6b8a37263
commit f24f1fe646

View File

@ -459,6 +459,36 @@ bool Configuration::ParseJson(Configuration* cfg, const char* json)
{ {
case MemberType::UnknownType: case MemberType::UnknownType:
break; break;
case MemberType::WeekDaysType: {
ATBWeekDay WeekDay;
if (QString(mb_name) == "Monday") {
WeekDay = parseWeekDay(*cfg, k, inner_obj_name, Qt::Monday, mb_name);
} else
if (QString(mb_name) == "Tuesday") {
WeekDay = parseWeekDay(*cfg, k, inner_obj_name, Qt::Tuesday, mb_name);
} else
if (QString(mb_name) == "Wednesday") {
WeekDay = parseWeekDay(*cfg, k, inner_obj_name, Qt::Wednesday, mb_name);
} else
if (QString(mb_name) == "Thursday") {
WeekDay = parseWeekDay(*cfg, k, inner_obj_name, Qt::Thursday, mb_name);
} else
if (QString(mb_name) == "Friday") {
WeekDay = parseWeekDay(*cfg, k, inner_obj_name, Qt::Friday, mb_name);
} else
if (QString(mb_name) == "Saturday") {
WeekDay = parseWeekDay(*cfg, k, inner_obj_name, Qt::Saturday, mb_name);
} else
if (QString(mb_name) == "Sunday") {
WeekDay = parseWeekDay(*cfg, k, inner_obj_name, Qt::Sunday, mb_name);
} else {
qCritical() << "ERROR: unknown week day" << mb_name;
}
cfg->WeekDays.insert(pair<Qt::DayOfWeek, ATBWeekDay>(WeekDay.m_id, WeekDay));
// qCritical() << WeekDay;
} break;
case MemberType::CarryOverType: { case MemberType::CarryOverType: {
if (QString(inner_obj_name) == QString("carry_over_id")) { if (QString(inner_obj_name) == QString("carry_over_id")) {
if (k->value.IsInt()) { if (k->value.IsInt()) {
@ -1062,6 +1092,11 @@ bool Configuration::ParseJson(Configuration* cfg, const char* json)
switch (mb_type) { switch (mb_type) {
case MemberType::UnknownType: case MemberType::UnknownType:
break; break;
case MemberType::WeekDaysType:
// qCritical() << "INSERT" << (int)WeekDay.m_id << WeekDay.m_date.toString(Qt::ISODate);
// cfg->WeekDays.insert(pair<Qt::DayOfWeek, ATBWeekDay>(WeekDay.m_id, WeekDay));
// qCritical() << WeekDay;
break;
case MemberType::PaymentMethodType: case MemberType::PaymentMethodType:
cfg->PaymentMethod.insert(pair<int, ATBPaymentMethod>(PaymentMethod.pme_id, PaymentMethod)); cfg->PaymentMethod.insert(pair<int, ATBPaymentMethod>(PaymentMethod.pme_id, PaymentMethod));
break; break;