Skip to content

Commit

Permalink
or -> and, remove nested ifs
Browse files Browse the repository at this point in the history
Signed-off-by: Kai-Uwe Hermann <[email protected]>
  • Loading branch information
hikinggrass committed Feb 23, 2024
1 parent 163a0a0 commit 588f987
Showing 1 changed file with 6 additions and 14 deletions.
20 changes: 6 additions & 14 deletions lib/ocpp/v201/database_handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -518,21 +518,13 @@ std::vector<MeterValue> DatabaseHandler::transaction_metervalues_get_all(const s
sampled_value.unitOfMeasure.emplace(unit);
}

if (select_stmt2.column_type(9) == SQLITE_TEXT or select_stmt2.column_type(10) == SQLITE_TEXT or
select_stmt2.column_type(11) == SQLITE_TEXT or select_stmt2.column_type(12) == SQLITE_TEXT) {
if (select_stmt2.column_type(9) == SQLITE_TEXT and select_stmt2.column_type(10) == SQLITE_TEXT and
select_stmt2.column_type(11) == SQLITE_TEXT and select_stmt2.column_type(12) == SQLITE_TEXT) {
SignedMeterValue signed_meter_value;
if (select_stmt2.column_type(9) == SQLITE_TEXT) {
signed_meter_value.signedMeterData = select_stmt2.column_text(9);
}
if (select_stmt2.column_type(10) == SQLITE_TEXT) {
signed_meter_value.signingMethod = select_stmt2.column_text(10);
}
if (select_stmt2.column_type(11) == SQLITE_TEXT) {
signed_meter_value.encodingMethod = select_stmt2.column_text(11);
}
if (select_stmt2.column_type(12) == SQLITE_TEXT) {
signed_meter_value.publicKey = select_stmt2.column_text(12);
}
signed_meter_value.signedMeterData = select_stmt2.column_text(9);
signed_meter_value.signingMethod = select_stmt2.column_text(10);
signed_meter_value.encodingMethod = select_stmt2.column_text(11);
signed_meter_value.publicKey = select_stmt2.column_text(12);

sampled_value.signedMeterValue.emplace(signed_meter_value);
}
Expand Down

0 comments on commit 588f987

Please sign in to comment.