Skip to content

Commit

Permalink
fix: code smells
Browse files Browse the repository at this point in the history
  • Loading branch information
trev-dev committed Oct 23, 2023
1 parent f36c436 commit 032512b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion backend/src/components/edx/exchange.js
Original file line number Diff line number Diff line change
Expand Up @@ -1093,7 +1093,7 @@ async function createSchool(req, res) {

const {school, user} = req.body;
const userHasEmptyVals = Object.values(user)
.reduce((result, currentValue) => result ? result : isEmptyString(currentValue), false);
.reduce((result, currentValue) => result || isEmptyString(currentValue), false);

const payload = {
school: set('districtId')(school.districtID)(
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/utils/institute/formRules.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@ const requiredWithOtherFieldValues = (
fieldValues = [],
message = 'Please fulfill all related fields.'
) => {
const toAnyFieldHasValue = (result, currentValue) => result ? result : !!(currentValue && currentValue.trim());
const toAnyFieldHasValue = (result, currentValue) => result || !!(currentValue?.trim());
return v => {
const thisFieldIsEmpty = !(v && v.trim());
const thisFieldIsEmpty = !(v?.trim());
const fieldsContainValues = fieldValues.reduce(toAnyFieldHasValue, false);
return thisFieldIsEmpty && fieldsContainValues ? message : true;
};
Expand Down

0 comments on commit 032512b

Please sign in to comment.