Closed lentschi closed 6 months ago
@twothreenine @yksflip I think this might be done and will close this for now.
The logic I implemented to detect whether there are any imperial units in the db is here:
https://github.com/foodcoopsat/foodsoft_hackathon/blob/b41b5ca454c7a02e81c02871246f4a49b1a341e5/db/migrate/20240316190959_create_article_units.rb#L35
<- That means, if there's any old plaintext unit ending in oz
or lb
, it will add imperial units to the default units available in the article master data form after the initial migration.
As for the list of default units, I have now configured the following (to see to which unit a code is referring either use the article units index in the foodsoft fork or check out Leo's excel files in #10):
Piece units: PTN, STC, XCU, XCN, XSH, X43, XST, XOK, XVA, XBX, XBH, XBE, XCX, XBJ, XUN, XOS, XDH, XBA, XFI, XBO, XBQ, XFB, XFT, XJR, XGR, XOW, X8B, XCV, XWA, XEI, XJT, XGY, XJY, XBD, XCR, XAI, XPA, XBK, XBI, XOV, XNT, XPK, XPC, XPX, X5M, XPR, XEC, X6H, X44, XBR, XCW, XBT, XSA, XBM, XSX, XDN, XAE, XSC, XLU, X5L, XPP, XPU, XBG, XP2, XCK, XPT, XGI, XTU
Metric scalar units: KGM, HGM, DJ, LTR, DLT, CLT, MLT
Imperial scalar units: LBR, ONZ, GLL, QTI, PTI
Regarding the seeds, I've added it to the temporary hackathon seeds in German (without imperial units) and English (with imperial units). This part will obviously have to be copied when we finally implement #16.
If you want to correct anything about that, please comment & reopen.
When migrating to the new unit schema, automatically detect whether there are any metric/imperial units in the old db and add default units accordingly. see https://github.com/foodcoopsat/foodsoft_hackathon/issues/24
For seeds, make it depend on the seed's locale.