fau-fablab / FabLabKasse

FabLabKasse, a Point-of-Sale Software for FabLabs and other public and trust-based workshops
https://fablabkasse.readthedocs.io
GNU General Public License v3.0
15 stars 4 forks source link

Faucard patch1 #147

Closed BDrescher closed 7 years ago

BDrescher commented 7 years ago

Hey all, as the current faucard payment occured errors in relation to the misuse of floating points precision, I've today tried to account all occurences of those and patch them. Additionally I have updated the log generation used for the invoice to be able to skip errors manually and made it a little safer.

@mgmax @patkan I would be happy if you got the time to review my changes and maybe point at code passages which are not yet safe enough.

codecov-io commented 7 years ago

Codecov Report

Merging #147 into development will decrease coverage by 0.17%. The diff coverage is 4.7%.

Impacted file tree graph

@@               Coverage Diff               @@
##           development     #147      +/-   ##
===============================================
- Coverage        28.38%   28.21%   -0.18%     
===============================================
  Files               62       62              
  Lines             7796     7865      +69     
===============================================
+ Hits              2213     2219       +6     
- Misses            5583     5646      +63
Impacted Files Coverage Δ
FabLabKasse/faucardPayment/faucard.py 29.57% <0%> (-0.43%) :arrow_down:
FabLabKasse/faucardPayment/generateLog.py 5.98% <1.85%> (-1.28%) :arrow_down:
FabLabKasse/UI/FAUcardPaymentDialogCode.py 15.57% <16.66%> (+0.57%) :arrow_up:
FabLabKasse/faucardPayment/MagPosLog.py 17.85% <25%> (-2.15%) :arrow_down:
FabLabKasse/faucardPayment/FAUcardPaymentThread.py 15.16% <5.88%> (+0.12%) :arrow_up:
...bKasse/cashPayment/client/PaymentDevicesManager.py 36.86% <0%> (+0.36%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 7b0c1d2...c10ed8e. Read the comment docs.

BDrescher commented 7 years ago

Hello, I've updated the code again and implemented some improvements mentioned by @mgmax . Additionally I updated the Dialog to use Decimal aswell to prevent false display and added a function to check the last MagPosLog entry if it was not booked. This could be extended further if desired. As the check is called before every payment, the coverage should be 100%.

mgmax commented 7 years ago

Please feel free to merge.

As a side note: I just pushed commit 7b0c1d2 to development which enforces Decimal for the common payment API (not FAU Card specific).