Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Helper file misteriously was clean up #169

Open
atherdon opened this issue Oct 15, 2018 · 0 comments
Open

Helper file misteriously was clean up #169

atherdon opened this issue Oct 15, 2018 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@atherdon
Copy link
Collaborator

atherdon commented Oct 15, 2018

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

@atherdon atherdon added the bug Something isn't working label Oct 15, 2018
@atherdon atherdon self-assigned this Oct 15, 2018
@atherdon atherdon added enhancement New feature or request and removed bug Something isn't working labels Oct 17, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant