Open atherdon opened 6 years ago
structure of our collection should be:
[
{
key: uuid(),
name: 'gl name',
dep: [
{
id: uuid(),
ing: [
{
id: uuid()
}
]
}
]
}
]
But be ready for example to create a different type of structure:
[
{
key: uuid(),
name: 'gl name',
ing: [
{
id: uuid(),
dep:
{
id: uuid()
}
}
]
}
]
first version was done by method getKeyArray
third method will incorporate this structure
let Ingredients = require(path.resolve(__dirname, 'ingredients'));
let Groceries = require(path.resolve(__dirname, 'grocery'));
let Departments = require(path.resolve(__dirname, 'departments'));
let Users = require(path.resolve(__dirname, 'users'));
i also need another one object, related to users.
like we have a big number of Groceries
but all of them should be assigned with admin user.
Can you do it?
like one method that calling `getKeyArray` and creating users with ids, then extracting id only from groceries object and adding to one user array with ids of groceries
(this is actually our full database for groceristar right now)
As additional methods, we can also create objects, related to this schemes(one of them is GS, for sure :))
i have doubts about method getKeyArray
first of all it's hard to understand what is he ding without printing it.
second of all it's confusing what is related to key and what is related to value.
also i find out that this array return 790672 more items ]
and i think it's a really big number. or maybe i'm wrong...
@atherdon getKeyArray returns array of objects, that one object has property name - key from department, property value - key from ingredient. For example Department object has
{
name: FreshVegetables,
key:0000-0000
}
Ingredient
{
"name": "Asparagus",
"department": "Fresh vegetables"
key: 1111-1111
}
{
"name": "Brocoli",
"department": "Fresh vegetables"
key: 2222-2222
}
In result
{"0000-0000" : "1111-1111"},
{"0000-0000" : "2222-2222"},
Or we can remake it like
{"0000-0000" : ["1111-1111","2222-2222"]},
This method returns just relation between ingredients in one json and departments in another json. If database can import json with array that has object with array and this array will have another object for example
[{
"1":[
{"2":["3"]
},
{"2"}
]
}
]
make sense
ok, so for me - this is the only function that we can use in the middle, so we still need to have another method, that will call this method. btw, can you advice about 79k of array elements?
@atherdon Sorry I have found my mistake. I will fix it
not a problem. i'm still expanding this task - will share my results(task list) with you soon. this is why i un-assign you from this task. i thnk it should be better explaned
We have a problem. If in Departments name of department is "Condiments / sauces" and in indgredients department is "Condiments / Sauces" it's defferrent string fields.
We have 303 tied all ingredients with all departments
We have a problem. If in Departments name of department is "Condiments / sauces" and in indgredients department is "Condiments / Sauces" it's defferrent string fields.
Can we catch such kind of things or only by eye? i'm aware of this problem. we need to find a way to do it #157
if we need just to match strings I think we can uppercase all strings and then to compare it
it's an interesting idea, but i think we should see this issue as part of the big issue. First of all - it's not only departments have duplicates. Second - Maria proposes to update the whole structure of departments. instead of having Dairy for all products, related to Milk, we'll have:
Dairy
- Milk
-- Cow Milk (ingredients/items/products)
-- Soy Milk (ingredients/items/products)
- Cheese
-- Mozarella (ingredients/items/products)
-- Parmesan (ingredients/items/products)
-- Dor Blue (ingredients/items/products)
-- Roquefort (ingredients/items/products)
~we need to add methods, that have 'key' at https://github.com/GroceriStar/groceristar-fetch/pull/182~
need I make another method like getKeyArrayDepAndIng for another table?
Not at this moment. I'm still gaining all information together.
if you wish to move this task forward - you can show me a method that will grab all grocery related information together. so I'll be one huge object. but the structure of this object is debatable, so only if you want to try - do it. or we can wait when I'll put all the important information for fetch into one place. Btw, did you saw content at 'discussion' task?
if you want to try - tell me - and I'll create a separated task. because this thread is dirty and hard to follow
[ ] Grocery object
[ ] Recipe object
[ ] Search object
explain how to use it and we should force our other developers to use this methods instead of small methods like - get ingredients, etc