orh>ddlZddlmZddlmZdZdZdZdZdS)N)datetime)CsvGamecZtj|d}|d}|S)Nz%d/%m/%Yz%Y-%m-%d)rstrptimestrftime)datedate_obj new_date_strs 7/var/lib/jenkins/jobs/Dev/workspace/CommonOperations.pyconvertDateForPostgresr s- z22H$$Z00L c8g}td5}tj|d}d}|D]T}|dkrG|d}|d}|d}|d}t||||} || |dz }U dddn #1swxYwY|S)Nzconfig\gamesSettings.csv;) delimiterr)opencsvreaderrappend) gamesSettingscsv_file csv_reader line_countrow game_nsuid game_titlegame_price_discount_alertgame_percentage_discount_alertcsvGames r loadCsvr" sM ( ) ) XZC888    CA~~ V  V ,/F)14Q.!*j:SUstt$$W--- !OJJ                 sA0BBBc.d}|D]}|j|krd}|S)NFT)nsuid)rr$ nsuid_foundcurrentGameSettingss r isTheNsuidPresentInGameSettingsr's1K,  $ - -K r cH|D]}|j|kr|j}|j}dt|zdzt|zdzt|zdzt|z}t ||t |ks|t |krdSdS)Nz"[Price Conditions] Current Game : z / z | Settled : TF)r$discount_price_alertdiscount_percentage_alertstrprintfloatint)r current_nsuid current_pricecurrent_percentager&setPrice setPercentage strMessages r $arePriceConditionsMetForNotificationr5$s,  $ 5 5*?H/IM=M@R@RRUZZ]`as]t]ttxGGJMNVJWJWWZ__befsbtbttJ *   x006HCP]L^L^6^6^dd 5r )rrrr r"r'r5r r r7sx "     r