Skip to content

Commit

Permalink
fix: fix typo in product quantity for ml. ref #311 & #314
Browse files Browse the repository at this point in the history
  • Loading branch information
raphodn committed Feb 21, 2024
1 parent d727ee8 commit d9ca758
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/components/PricePrice.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,14 @@
</template>

<script>
import constants from '../constants'
import utils from '../utils.js'
export default {
props: {
'price': null,
'productQuantity': null,
'productQuantityUnit': 'g', // 'mL'
'productQuantityUnit': constants.PRODUCT_QUANTITY_UNIT_G,
'hidePriceDate': false
},
data() {
Expand Down Expand Up @@ -71,7 +72,7 @@ export default {
}
if (this.hasProductQuantity) {
const pricePerUnit = (price / this.productQuantity) * 1000
if (this.productQuantityUnit === 'mL') {
if (this.productQuantityUnit === constants.PRODUCT_QUANTITY_UNIT_ML) {
return this.$t('PriceCard.PriceValueDisplayLitre', [this.getPriceValue(pricePerUnit, this.priceCurrency)])
}
return this.$t('PriceCard.PriceValueDisplayKilogram', [this.getPriceValue(pricePerUnit, this.priceCurrency)])
Expand Down
6 changes: 4 additions & 2 deletions src/components/ProductQuantityChip.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@
</template>

<script>
import constants from '../constants'
export default {
props: {
productQuantity: null,
productQuantityUnit: 'g' // 'mL'
productQuantityUnit: constants.PRODUCT_QUANTITY_UNIT_G
},
computed: {
productQuantityWithUnitDisplay() {
if (this.productQuantityUnit === 'mL') {
if (this.productQuantityUnit === constants.PRODUCT_QUANTITY_UNIT_ML) {
return this.$t('ProductCard.ProductQuantityMililitre', [this.productQuantity])
}
return this.$t('ProductCard.ProductQuantityGram', [this.productQuantity])
Expand Down
2 changes: 2 additions & 0 deletions src/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ export default {
OFF_WIKI_APP_URL: 'https://wiki.openfoodfacts.org/Project:Open-Prices',
OFF_WIKI_GDPR_REQUEST_URL: 'https://wiki.openfoodfacts.org/GDPR_request',
CURRENCY_LIST: ['ADP', 'AED', 'AFA', 'AFN', 'ALK', 'ALL', 'AMD', 'ANG', 'AOA', 'AOK', 'AON', 'AOR', 'ARA', 'ARL', 'ARM', 'ARP', 'ARS', 'ATS', 'AUD', 'AWG', 'AZM', 'AZN', 'BAD', 'BAM', 'BAN', 'BBD', 'BDT', 'BEC', 'BEF', 'BEL', 'BGL', 'BGM', 'BGN', 'BGO', 'BHD', 'BIF', 'BMD', 'BND', 'BOB', 'BOL', 'BOP', 'BOV', 'BRB', 'BRC', 'BRE', 'BRL', 'BRN', 'BRR', 'BRZ', 'BSD', 'BTN', 'BUK', 'BWP', 'BYB', 'BYN', 'BYR', 'BZD', 'CAD', 'CDF', 'CHE', 'CHF', 'CHW', 'CLE', 'CLF', 'CLP', 'CNH', 'CNX', 'CNY', 'COP', 'COU', 'CRC', 'CSD', 'CSK', 'CUC', 'CUP', 'CVE', 'CYP', 'CZK', 'DDM', 'DEM', 'DJF', 'DKK', 'DOP', 'DZD', 'ECS', 'ECV', 'EEK', 'EGP', 'ERN', 'ESA', 'ESB', 'ESP', 'ETB', 'EUR', 'FIM', 'FJD', 'FKP', 'FRF', 'GBP', 'GEK', 'GEL', 'GHC', 'GHS', 'GIP', 'GMD', 'GNF', 'GNS', 'GQE', 'GRD', 'GTQ', 'GWE', 'GWP', 'GYD', 'HKD', 'HNL', 'HRD', 'HRK', 'HTG', 'HUF', 'IDR', 'IEP', 'ILP', 'ILR', 'ILS', 'INR', 'IQD', 'IRR', 'ISJ', 'ISK', 'ITL', 'JMD', 'JOD', 'JPY', 'KES', 'KGS', 'KHR', 'KMF', 'KPW', 'KRH', 'KRO', 'KRW', 'KWD', 'KYD', 'KZT', 'LAK', 'LBP', 'LKR', 'LRD', 'LSL', 'LTL', 'LTT', 'LUC', 'LUF', 'LUL', 'LVL', 'LVR', 'LYD', 'MAD', 'MAF', 'MCF', 'MDC', 'MDL', 'MGA', 'MGF', 'MKD', 'MKN', 'MLF', 'MMK', 'MNT', 'MOP', 'MRO', 'MRU', 'MTL', 'MTP', 'MUR', 'MVP', 'MVR', 'MWK', 'MXN', 'MXP', 'MXV', 'MYR', 'MZE', 'MZM', 'MZN', 'NAD', 'NGN', 'NIC', 'NIO', 'NLG', 'NOK', 'NPR', 'NZD', 'OMR', 'PAB', 'PEI', 'PEN', 'PES', 'PGK', 'PHP', 'PKR', 'PLN', 'PLZ', 'PTE', 'PYG', 'QAR', 'RHD', 'ROL', 'RON', 'RSD', 'RUB', 'RUR', 'RWF', 'SAR', 'SBD', 'SCR', 'SDD', 'SDG', 'SDP', 'SEK', 'SGD', 'SHP', 'SIT', 'SKK', 'SLE', 'SLL', 'SOS', 'SRD', 'SRG', 'SSP', 'STD', 'STN', 'SUR', 'SVC', 'SYP', 'SZL', 'THB', 'TJR', 'TJS', 'TMM', 'TMT', 'TND', 'TOP', 'TPE', 'TRL', 'TRY', 'TTD', 'TWD', 'TZS', 'UAH', 'UAK', 'UGS', 'UGX', 'USD', 'USN', 'USS', 'UYI', 'UYP', 'UYU', 'UYW', 'UZS', 'VEB', 'VED', 'VEF', 'VES', 'VND', 'VNN', 'VUV', 'WST', 'XAF', 'XAG', 'XAU', 'XBA', 'XBB', 'XBC', 'XBD', 'XCD', 'XDR', 'XEU', 'XFO', 'XFU', 'XOF', 'XPD', 'XPF', 'XPT', 'XRE', 'XSU', 'XTS', 'XUA', 'XXX', 'YDD', 'YER', 'YUD', 'YUM', 'YUN', 'YUR', 'ZAL', 'ZAR', 'ZMK', 'ZMW', 'ZRN', 'ZRZ', 'ZWD', 'ZWL', 'ZWR'],
PRODUCT_QUANTITY_UNIT_G: 'g',
PRODUCT_QUANTITY_UNIT_ML: 'ml',
FILTER_PARAM: 'filter',
PRODUCT_FILTER_LIST: [
{ key: 'hide_price_count_gte_1', value: 'Hide products with prices' },
Expand Down

0 comments on commit d9ca758

Please sign in to comment.