Skip to content

Commit

Permalink
Merge pull request #3302 from LiteFarmOrg/LF-4029-update-responses-fo…
Browse files Browse the repository at this point in the history
…r-what-type-of-certification-during-certification-flow

LF-4029 - change name of Organic type selection choice to third party…
  • Loading branch information
SayakaOno authored Jul 18, 2024
2 parents 2293327 + 161d1be commit 91f61fd
Show file tree
Hide file tree
Showing 9 changed files with 50 additions and 17 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* Copyright (c) 2024 LiteFarm.org
* This file is part of LiteFarm.
*
* LiteFarm is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* LiteFarm is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details, see <https://www.gnu.org/licenses/>.
*/

export const up = async function (knex) {
await knex('certifications')
.update({
certification_translation_key: 'THIRD_PARTY_ORGANIC',
certification_type: 'Third-party Organic',
})
.where({ certification_translation_key: 'ORGANIC', certification_type: 'Organic' });
};

export const down = async function (knex) {
await knex('certifications')
.update({ certification_translation_key: 'ORGANIC', certification_type: 'Organic' })
.where({
certification_translation_key: 'THIRD_PARTY_ORGANIC',
certification_type: 'Third-party Organic',
});
};
7 changes: 6 additions & 1 deletion packages/api/tests/organicCertifierSurvey.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,13 @@ describe('organic certification Tests', () => {
describe('Get all supported certifications', () => {
test('User should get all supported certifications', async (done) => {
getAllSupportedCertificationsRequest({}, (err, res) => {
const thirdPartyOrganic = res.body.find(
(cert) => cert.certification_translation_key === 'THIRD_PARTY_ORGANIC',
);
const pgs = res.body.find((cert) => cert.certification_translation_key === 'PGS');
expect(res.status).toBe(200);
expect(res.body[0].certification_type).toBe('Organic');
expect(thirdPartyOrganic.certification_type).toBe('Third-party Organic');
expect(pgs.certification_type).toBe('Participatory Guarantee System');
done();
});
});
Expand Down
4 changes: 2 additions & 2 deletions packages/webapp/.storybook/state.js
Original file line number Diff line number Diff line change
Expand Up @@ -1635,8 +1635,8 @@ export default {
entities: {
1: {
certification_id: 1,
certification_translation_key: 'ORGANIC',
certification_type: 'Organic',
certification_translation_key: 'THIRD_PARTY_ORGANIC',
certification_type: 'Third-party Organic',
},
2: {
certification_id: 2,
Expand Down
2 changes: 1 addition & 1 deletion packages/webapp/public/locales/en/certifications.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"ORGANIC": "Organic",
"THIRD_PARTY_ORGANIC": "Third-party organic",
"PGS": "Participatory guarantee system"
}
2 changes: 1 addition & 1 deletion packages/webapp/public/locales/es/certifications.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"ORGANIC": "Orgánica",
"THIRD_PARTY_ORGANIC": "Orgánica por auditoría",
"PGS": "Sistema participativo de garantía"
}
2 changes: 1 addition & 1 deletion packages/webapp/public/locales/fr/certifications.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"ORGANIC": "Biologique",
"THIRD_PARTY_ORGANIC": "Biologique par audit",
"PGS": "Système de participation garantie"
}
2 changes: 1 addition & 1 deletion packages/webapp/public/locales/pt/certifications.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"ORGANIC": "Orgânica por auditoria",
"THIRD_PARTY_ORGANIC": "Orgânica por auditoria",
"PGS": "Sistema Participativo de Garantia (SPG)"
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import React from 'react';
import decorators from '../../config/Decorators';
import {
PureCertifierSelectionScreen,
} from '../../../../components/OrganicCertifierSurvey/CertifierSelection/PureCertifierSelectionScreen';
import { PureCertifierSelectionScreen } from '../../../../components/OrganicCertifierSurvey/CertifierSelection/PureCertifierSelectionScreen';
import { chromaticSmallScreen } from '../../config/chromatic';

export default {
Expand Down Expand Up @@ -70,8 +68,8 @@ const certifiers = [
const certifications = [
{
certification_id: 1,
certification_type: 'Organic',
certification_translation_key: 'ORGANIC',
certification_type: 'Third-party Organic',
certification_translation_key: 'THIRD_PARTY_ORGANIC',
},
{
certification_id: 2,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import React from 'react';
import {
PureCertificationSelection,
} from '../../../../components/OrganicCertifierSurvey/CertificationSelection/PureCertificationSelection';
import { PureCertificationSelection } from '../../../../components/OrganicCertifierSurvey/CertificationSelection/PureCertificationSelection';
import decorators from '../../config/Decorators';
import { chromaticSmallScreen } from '../../config/chromatic';

Expand All @@ -21,8 +19,8 @@ Primary.args = {
certifications: [
{
certification_id: 1,
certification_type: 'Organic',
certification_translation_key: 'ORGANIC',
certification_type: 'Third-party Organic',
certification_translation_key: 'THIRD_PARTY_ORGANIC',
},
{
certification_id: 2,
Expand Down

0 comments on commit 91f61fd

Please sign in to comment.