Skip to content

Commit

Permalink
fixed version of promotions downloader
Browse files Browse the repository at this point in the history
  • Loading branch information
AKorets committed Jul 31, 2023
1 parent 902e2f0 commit 9908990
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 43 deletions.
64 changes: 32 additions & 32 deletions conf/all_promotions.json
Original file line number Diff line number Diff line change
@@ -1,54 +1,54 @@
{
"ignore": [
"minpurchaseamnt",
"additionalistotal",
"weightunit",
"giftsitems",
"additionalstotals",
"maxqty",
"discountedprice",
"dllverno",
"additionalsgiftcount",
"additionalgiftcount",
"xmldocversion",
"discountedprice",
"discountedpricepermida",
"remarks",
"additionaliscoupon",
"additionalisactive",
"promotions",
"giftitemprice",
"weightunit",
"discountedpricepermida",
"isweightedpromo",
"giftsitems",
"additionalsminbasketamount",
"additionalminbasketamount",
"additionalsgiftcount",
"additionalrestrictions",
"minqty",
"dllverno",
"discounttype",
"clubid",
"discountrate",
"additionalsminbasketamount",
"isweightedpromo",
"additionalrestrictions",
"additionalscoupon",
"giftitemprice",
"additionalminbasketamount",
"itemtype",
"xmldocversion",
"remarks"
"minpurchaseamount"
],
"tags_dict": {
"minnoofitemofered": "minnoofitemsoffered",
"additionaliscoupon": "additionalscoupon",
"additionalstotals": "additionalistotal",
"promotionupdatedate": "priceupdatedate",
"minpurchaseamount": "minqty",
"minpurchaseamnt": "minqty"
"promotionupdatedate": "priceupdatedate"
},
"tags": [
"promotionstarthour",
"promotionid",
"promotionstartdate",
"subchainid",
"chainid",
"minnoofitemsoffered",
"itemcode",
"rewardtype",
"additionalscoupon",
"promotionstarthour",
"itemcode",
"priceupdatedate",
"storeid",
"minqty",
"chainid",
"promotionendhour",
"additionalistotal",
"promotiondescription",
"promotionenddate",
"isgiftitem",
"priceupdatedate",
"bikoretno",
"clubid",
"subchainid",
"promotiondescription",
"allowmultiplediscounts",
"promotionstartdate",
"promotionid"
"isgiftitem",
"allowmultiplediscounts"
]
}
16 changes: 7 additions & 9 deletions mapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,21 +325,19 @@ def generate_promo_configuration():
, 'discountedpricepermida', 'discountedprice',
'discountrate', 'discounttype',
'giftsitems', 'giftitemprice','additionalminbasketamount'
,'clubid', 'itemtype'
,'clubid', 'itemtype','additionalscoupon','additionaliscoupon'
, 'additionalistotal', 'additionalstotals',
'minqty', 'minpurchaseamount', 'minpurchaseamnt'
}
tags_dict = {'minnoofitemofered':'minnoofitemsoffered',
'additionaliscoupon':'additionalscoupon',
'additionalstotals':'additionalistotal',
'promotionupdatedate':'priceupdatedate',
'minpurchaseamount':'minqty',
'minpurchaseamnt':'minqty'}
'promotionupdatedate':'priceupdatedate'}
tags = { 'chainid', 'storeid', 'bikoretno', 'subchainid'
, 'promotiondescription', 'priceupdatedate',
'promotionendhour', 'allowmultiplediscounts',
'additionalscoupon', 'promotionstartdate', 'promotionid',
'promotionstartdate', 'promotionid',
'promotionstarthour', 'isgiftitem', 'itemcode',
'minqty', 'rewardtype', 'minnoofitemsoffered',
'promotionenddate', 'additionalistotal'}
'rewardtype', 'minnoofitemsoffered',
'promotionenddate'}
all_prices = {'ignore': list(ignore),
'tags_dict': tags_dict,
'tags':list(tags)}
Expand Down
4 changes: 2 additions & 2 deletions parsers/price_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def download_all_promo_prices(progress_bar=None, force=False, output_folder = "p
pattern = f'{FileTypesFilters.PROMO_FILE.value["should_contain"]}*.xml'
files_types = FileTypesFilters.only_promo()
download_type_data = DownloadTypeData(pattern, files_types)
download_all_prices(progress_bar, force, output_folder,
return download_all_prices(progress_bar, force, output_folder,
data_prices_path, conf, download_type_data)

def parse_item_xml_extension(root, chain_name, all_prices, item_info_dict,
Expand Down Expand Up @@ -99,7 +99,7 @@ def download_all_prices(progress_bar=None, force=False,
print('failed to get root of '+data_file)
failed_files.append(data_file)
continue
Logger.info(f"Parsing file : {data_file}")
#Logger.info(f"Parsing file : {data_file}")
item_info_dict = {}
parse_item_xml_extension(root, scrapper.chain, all_prices, item_info_dict,
price_rows, 'itemcode')
Expand Down

0 comments on commit 9908990

Please sign in to comment.