Skip to content

Commit

Permalink
Merge pull request #2175 from LiteFarmOrg/collab/fixes-jul-2022
Browse files Browse the repository at this point in the history
Bring approved fixes from hotfix to integration
  • Loading branch information
smattingly authored Jul 21, 2022
2 parents e955099 + 1b7122a commit 9f0a13c
Show file tree
Hide file tree
Showing 11 changed files with 39 additions and 10 deletions.
27 changes: 27 additions & 0 deletions packages/api/db/migration/20220718193208_add_sandbox_column.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* Copyright 2019, 2020, 2021, 2022 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/>.
*/

exports.up = async function (knex) {
await knex.schema.alterTable('users', (table) => {
table.boolean('sandbox_user').defaultTo(false);
});
return knex('users').update({ sandbox_user: false });
};

exports.down = async function (knex) {
return knex.schema.alterTable('users', (table) => {
table.dropColumns('sandbox_user');
});
};
4 changes: 2 additions & 2 deletions packages/api/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/api/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "litefarm-api",
"version": "3.2.1",
"version": "3.2.3",
"description": "LiteFarm API server",
"main": "./api/src/server.js",
"scripts": {
Expand Down
1 change: 1 addition & 0 deletions packages/api/src/models/userModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ class User extends Model {
phone_number: { type: ['string', null] },
user_address: { type: ['string', null] },
email: { type: 'email' },
sandbox_user: { type: 'boolean' },
notification_setting: {
type: 'object',
required: [
Expand Down
2 changes: 1 addition & 1 deletion packages/webapp/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "litefarm-webapp",
"version": "3.2.1",
"version": "3.2.3",
"description": "LiteFarm Web application",
"scripts": {
"dev": "CYPRESS_COVERAGE=TRUE vite",
Expand Down
2 changes: 1 addition & 1 deletion packages/webapp/public/locales/es/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,7 @@
"DRAWING_MANAGER": {
"REDRAW": "Repintar",
"ZERO_AREA_DETECTED": "Campo sin area detectado. Por favor, agrega mas puntos o comienza de nuevo.",
"ZERO_LENGTH_DETECTED": "Linea sin medida. Por favor, comienza de nuevo."
"ZERO_LENGTH_DETECTED": "Línea sin longitud detectada. Por favor dibuja de nuevo."
},
"EXPORT_MODAL": {
"BODY": "Como quieres exportar el mapa?",
Expand Down
2 changes: 1 addition & 1 deletion packages/webapp/public/locales/pt/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,7 @@
"DRAWING_MANAGER": {
"REDRAW": "Redesenhar",
"ZERO_AREA_DETECTED": "Campo sem área detectado. Por favor adicione mais pontos ao desenho atual ou desenhe novamente.",
"ZERO_LENGTH_DETECTED": "MISSING"
"ZERO_LENGTH_DETECTED": "Linha sem comprimento detectado. Por favor, desenhe novamente."
},
"EXPORT_MODAL": {
"BODY": "Como você quer exportar o seu mapa?",
Expand Down
2 changes: 2 additions & 0 deletions packages/webapp/src/components/Profile/EditUser/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export default function PureEditUser({
3: t('role:WORKER'),
5: t('role:EXTENSION_OFFICER'),
};

const genderOptions = [
{ value: 'MALE', label: t('gender:MALE') },
{ value: 'FEMALE', label: t('gender:FEMALE') },
Expand All @@ -51,6 +52,7 @@ export default function PureEditUser({
value: role_id,
label: dropDownMap[role_id],
}));

const roleOption = isPseudoUser
? { value: 3, label: dropDownMap[3] }
: { value: userFarm.role_id, label: dropDownMap[userFarm.role_id] };
Expand Down
1 change: 0 additions & 1 deletion packages/webapp/src/containers/Map/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,6 @@ export default function Map({ history }) {
maps.event.addListener(drawingManagerInit, 'polylinecomplete', function (polyline) {
const polylineLengthCheck = (path) => {
if (Math.round(maps.geometry.spherical.computeLength(path)) === 0) {
console.log('Zero length!');
setShowZeroLengthWarning(true);
} else {
setShowZeroLengthWarning(false);
Expand Down
4 changes: 2 additions & 2 deletions packages/webapp/src/containers/Profile/EditUser.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ export default function EditUser({ history, match }) {
}, [user_id, currentUserId]);

const getReqBody = (data) => {
const role_id = parseInt(data.role_id.value);
const role_id = data.role_id ? parseInt(data.role_id?.value) : null;
const reqBody = {
...data,
user_id,
role_id,
wage: { amount: data.wage.amount, type: userFarm.wage?.type || 'hourly' },
};
if (role_id === userFarm.role_id) delete reqBody.role_id;
if (role_id === userFarm.role_id || !role_id) delete reqBody.role_id;
if (data.wage?.amount === userFarm.wage?.amount) delete reqBody.wage;
return reqBody;
};
Expand Down
2 changes: 1 addition & 1 deletion packages/webapp/src/util/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ export const DO_ORIGIN_URL = `https://${
export const DO_CDN_URL = `https://${
import.meta.env.VITE_DO_BUCKET_NAME
}.nyc3.cdn.digitaloceanspaces.com`;
export const APP_VERSION = '3.2.1';
export const APP_VERSION = '3.2.3';

0 comments on commit 9f0a13c

Please sign in to comment.