fixed confused amounts and prices, fixed decimal separators "," and "."
This commit is contained in:
parent
dd06dfa30a
commit
66ffe47fb8
5
main.cpp
5
main.cpp
|
@ -21,7 +21,12 @@
|
|||
# include <email_parser/emailparser.h>
|
||||
#endif
|
||||
|
||||
#include <opencv2/dnn.hpp>
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
// cv::dnn::readNetFromTensorflow("/home/leca/model.keras");
|
||||
|
||||
// return 0;
|
||||
curl_global_init(CURL_GLOBAL_ALL);
|
||||
qRegisterMetaType<Check>("Check");
|
||||
|
||||
|
|
|
@ -669,7 +669,7 @@
|
|||
<context>
|
||||
<name>QObject</name>
|
||||
<message>
|
||||
<location filename="../main.cpp" line="55"/>
|
||||
<location filename="../main.cpp" line="60"/>
|
||||
<source>Using locale: </source>
|
||||
<translation>Using locale: </translation>
|
||||
</message>
|
||||
|
|
|
@ -645,7 +645,7 @@
|
|||
<context>
|
||||
<name>QObject</name>
|
||||
<message>
|
||||
<location filename="../main.cpp" line="55"/>
|
||||
<location filename="../main.cpp" line="60"/>
|
||||
<source>Using locale: </source>
|
||||
<translation>Использую локаль: </translation>
|
||||
</message>
|
||||
|
|
|
@ -229,8 +229,7 @@ std::vector<std::wstring> find_products_in_html(std::string html) {
|
|||
}
|
||||
|
||||
std::vector<std::wstring> find_amounts_in_html(std::string html) {
|
||||
return find_in_html(html, "(?<=X <\\/span><span>)\\d+(\\.|,)\\d{2}(?=<\\/span>)");
|
||||
|
||||
return find_in_html(html, "(?<=<div><span>)\\d+(\\.|\\,)?\\d{0,3}(?=<\\/span>)");
|
||||
}
|
||||
|
||||
std::vector<std::wstring> find_net_weights_in_names(std::vector<std::wstring> &names) {
|
||||
|
@ -257,7 +256,7 @@ std::vector<std::wstring> find_net_weights_in_names(std::vector<std::wstring> &n
|
|||
}
|
||||
|
||||
std::vector<std::wstring> find_prices_in_html(std::string html) {
|
||||
return find_in_html(html, "(?<=<div><span>)\\d+(\\.|\\,)?\\d{0,3}(?=<\\/span>)");
|
||||
return find_in_html(html, "(?<=X <\\/span><span>)\\d+(\\.|,)\\d{2}(?=<\\/span>)");
|
||||
}
|
||||
|
||||
void dumpVectorsToStderr(std::vector<std::wstring> &products, std::vector<std::wstring> &amounts, std::vector<std::wstring> &net_weights, std::vector<std::wstring> &prices) {
|
||||
|
@ -321,6 +320,7 @@ Check parseOfdRuAnswer(std::string html) {
|
|||
for (int i = 0; i < products.size(); i ++) {
|
||||
// std::cout << "Adding to check: ";
|
||||
// std::cout << to_utf8(products[i]) << " " << to_utf8(prices[i]) << " " << to_utf8(net_weights[i]) << " " << to_utf8(amounts[i]) << std::endl;
|
||||
std::replace(amounts[i].begin(), amounts[i].end(), from_utf8(",")[0], from_utf8(".")[0]);
|
||||
Goods goods(to_utf8(products[i]), std::stod(prices[i]), to_utf8(net_weights[i]), std::stod(amounts[i]));
|
||||
c.add_goods(goods);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue