grocy/migrations/0255.sql
google-labs-jules[bot] f41cb227fc feat: Adapt Grocy for the Chinese market
This commit introduces a range of features and improvements to make Grocy more suitable for the Chinese market, based on the high-level goal of creating a better item management system for Chinese households.

The key changes include:

1.  **New 'Last Used' Report:** A new stock report has been added to show products that have not been used for a long time. This feature is inspired by the 'Danshari' (断舍离) philosophy of decluttering and helps you identify and reduce waste. This includes a new controller method, a route, a Blade view, and the necessary JavaScript for the interactive data table.

2.  **Chinese Units of Measurement:** A database migration has been added to include common Chinese units of measurement, such as 克 (gram), 斤 (jin), 公斤 (kilogram), and others. This makes inventory and recipe management more intuitive for you. Conversion factors between related units are also included.

3.  **Improved Chinese Localization:** The Chinese (zh_CN) localization file has been significantly updated by filling in a large number of previously missing translations. This provides a more complete and professional experience for you. New translations for the 'Last Used' report have also been added.

4.  **Future Work Planning:** A `TODO.md` file has been created to track the next steps for this project, specifically noting the need to research and integrate a barcode lookup API that is more suitable for Chinese products.
2025-08-13 13:55:17 +00:00

36 lines
1.8 KiB
SQL

-- Add common Chinese quantity units
INSERT INTO quantity_units (name, name_plural, description) VALUES ('', '', 'gram');
INSERT INTO quantity_units (name, name_plural, description) VALUES ('', '', 'jin (500g)');
INSERT INTO quantity_units (name, name_plural, description) VALUES ('公斤', '公斤', 'kilogram');
INSERT INTO quantity_units (name, name_plural, description) VALUES ('', '', 'piece/item');
INSERT INTO quantity_units (name, name_plural, description) VALUES ('', '', 'pack');
INSERT INTO quantity_units (name, name_plural, description) VALUES ('', '', 'bottle');
INSERT INTO quantity_units (name, name_plural, description) VALUES ('', '', 'can/jar');
INSERT INTO quantity_units (name, name_plural, description) VALUES ('', '', 'liter');
INSERT INTO quantity_units (name, name_plural, description) VALUES ('毫升', '毫升', 'milliliter');
-- Add conversions between them
-- 1 jin = 500 gram
INSERT INTO quantity_unit_conversions (from_qu_id, to_qu_id, factor)
SELECT from_qu.id, to_qu.id, 500
FROM quantity_units from_qu, quantity_units to_qu
WHERE from_qu.name = '' AND to_qu.name = '';
-- 1 kilogram = 1000 gram
INSERT INTO quantity_unit_conversions (from_qu_id, to_qu_id, factor)
SELECT from_qu.id, to_qu.id, 1000
FROM quantity_units from_qu, quantity_units to_qu
WHERE from_qu.name = '公斤' AND to_qu.name = '';
-- 1 kilogram = 2 jin
INSERT INTO quantity_unit_conversions (from_qu_id, to_qu_id, factor)
SELECT from_qu.id, to_qu.id, 2
FROM quantity_units from_qu, quantity_units to_qu
WHERE from_qu.name = '公斤' AND to_qu.name = '';
-- 1 liter = 1000 milliliter
INSERT INTO quantity_unit_conversions (from_qu_id, to_qu_id, factor)
SELECT from_qu.id, to_qu.id, 1000
FROM quantity_units from_qu, quantity_units to_qu
WHERE from_qu.name = '' AND to_qu.name = '毫升';