]> git.stg.codes - stg.git/blobdiff - projects/stargazer/plugins/store/postgresql/postgresql_store_tariffs.cpp
Patch from SpiderX <spiderx@spiderx.dp.ua> - path to FreeRADIUS plugins.
[stg.git] / projects / stargazer / plugins / store / postgresql / postgresql_store_tariffs.cpp
index fc35f7889092e7141207dce4e8a173b80b07d64c..7d63b57420cd2f4973f02a29a2413fde10094896 100644 (file)
 #include <string>
 #include <vector>
 #include <sstream>
+#include <cmath>
 
 #include <libpq-fe.h>
 
 #include "postgresql_store.h"
-#include "stg/stg_locker.h"
+#include "stg/locker.h"
 
 //-----------------------------------------------------------------------------
 int POSTGRESQL_STORE::GetTariffsList(vector<string> * tariffsList) const
@@ -543,8 +544,8 @@ for (int i = 0; i < std::min(tuples, DIR_NUM); ++i)
     tuple >> td->dirPrice[dir].hNight;
     tuple >> td->dirPrice[dir].mNight;
 
-    if (td->dirPrice[dir].priceDayA == td->dirPrice[dir].priceNightA &&
-        td->dirPrice[dir].priceDayB == td->dirPrice[dir].priceNightB)
+    if (std::fabs(td->dirPrice[dir].priceDayA - td->dirPrice[dir].priceNightA) > 1.0e-3 &&
+        std::fabs(td->dirPrice[dir].priceDayB - td->dirPrice[dir].priceNightB) > 1.0e-3)
         {
         td->dirPrice[dir].singlePrice = true;
         }