Skip to content

Helper file misteriously was clean up #169

@atherdon

Description

@atherdon

Description/Steps to reproduce

UPD. at Expo we have a project with Helper file from groceristar-app

ok, a bit info.
at October, 3 I create a task in order to move default functions that we have in our file:
src/config/HelperFunctions.js into our groceristar-fetch module. and i remember that file has a lot of data inside. Today we checked this file and didn't find that methods(not sure why).

difference can be seen here:
screencapture-github-chickenkyiv-recipe-app-react-native-blob-master-src-config-helperfunctions-js-2018-10-16-02_21_18
screencapture-snack-expo-io-sofianed-recipe-app-2018-10-16-02_21_53

Code that is missing(yep, a bad way to manage changes, but fast):

import gf from '@groceristar/groceristar-fetch/groceristar';
import uuid from 'uuidv4';

const getOldGrocery = gf.getGrocery();
let newGrocery = getOldGrocery;

export const getAllDepartmentList = () => {
  const newAllDepartments = gf.getAllDepartments();
  const newAllDepartmentsObject = newAllDepartments.map(item => ({
    key: uuid(),
    departmentName: item,
  }));

  return newAllDepartmentsObject;
};

export const getAllIngredientsList = DeparmentName => {
  const Ingredients = gf.getAllIngredientsByOneDepartment(`${DeparmentName}`);
  const IngredientsObject = Ingredients.map(item => ({
    key: uuid(),
    IngredientName: item,
    isChecked: false,
  }));

  return IngredientsObject;
};

export const getAllGrocery = () => {
  const GroceryObjectArray = newGrocery.map(item => ({
    key: uuid(),
    IngredientName: item,
  }));

  return GroceryObjectArray;
};

export const getAllGroceryDepartment = departmentArray => {
  const departmentArrayObject = departmentArray.map(item => ({
    key: uuid(),
    departmentName: item,
    isChecked: false,
  }));
  return departmentArrayObject;
};

export const createNewGroceryList = newDepartment => {
  const isAvailable = newGrocery.filter(item => {
    if (item.name === newDepartment.name) {
      return true;
    }
    return false;
  });

  if (isAvailable.length === 0) {
    const newDepartmentList = [...newGrocery, newDepartment];
    newGrocery = newDepartmentList;
  }
};

Expected result

Additional information

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions