test add compact format
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
#include "period_year.h"
|
||||
#include "tariff_permit_type.h"
|
||||
|
||||
#include <QDir>
|
||||
#include <QFile>
|
||||
#include <QFileInfo>
|
||||
#include <QDateTime>
|
||||
@@ -446,19 +447,29 @@ int CALCULATE_LIBRARY_API get_maximal_parkingprice(Configuration *cfg,
|
||||
|
||||
int CALCULATE_LIBRARY_API get_zone_nr(int zone)
|
||||
{
|
||||
if(zone > -1) return zone;
|
||||
else
|
||||
{
|
||||
QFile zone("/mnt/system_data/zone_nr");
|
||||
if (zone.exists()) {
|
||||
QFileInfo finfo(zone);
|
||||
if (zone.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||
QTextStream in(&zone);
|
||||
return in.readLine(100).toInt();
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
if (zone > -1)
|
||||
return zone;
|
||||
|
||||
#ifdef DESKTOP_LINUX
|
||||
QString zonePath = QDir::homePath() + "/atbapp/zone_nr";
|
||||
#else
|
||||
QString zonePath = "/mnt/system_data/zone_nr";
|
||||
#endif
|
||||
|
||||
QFile zoneFile(zonePath);
|
||||
|
||||
if (zoneFile.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||
QTextStream in(&zoneFile);
|
||||
|
||||
bool ok = false;
|
||||
int zoneNr = in.readLine(100).trimmed().toInt(&ok);
|
||||
|
||||
if (ok)
|
||||
return zoneNr;
|
||||
}
|
||||
|
||||
qWarning() << "Failed to read zone number from:" << zonePath;
|
||||
return -1;
|
||||
}
|
||||
|
||||
CalcState CALCULATE_LIBRARY_API init_tariff(parking_tariff_t **tariff, char const *config_file) {
|
||||
|
||||
Reference in New Issue
Block a user