Jump to conversation
Unresolved conversations (10)
@petersg83 petersg83 Nov 14, 2022
yes, no need to have a sorted array
...se/lib/entity-manager/relations-sorter.js
@petersg83 petersg83 Nov 14, 2022
check that the array is sorted
...se/lib/entity-manager/relations-sorter.js
petersg83
Pierre Noël
@petersg83 petersg83 Nov 14, 2022
some typos
...se/lib/entity-manager/relations-sorter.js
@petersg83 petersg83 Nov 9, 2022
It will break later in the case you connect only the last element. Example: you have the existing relations : 5, 1, 10. If you do `connect: [{ id: 10 }]`, then it breaks later because `this.arr` becomes empty
Outdated
...e/lib/entity-manager/relations-orderer.js
Marc-Roig
Marc Roig
@petersg83 petersg83 Nov 9, 2022
Are we sure the array is always sorted by order?
Outdated
...e/lib/entity-manager/relations-orderer.js
Marc-Roig
Marc Roig
@petersg83 petersg83 Nov 9, 2022
would it make more sense if it was directly in `_updateRelationOrder`? And then maybe rename `_updateRelationOrder` to `_insertRelation` ?
Outdated
...e/lib/entity-manager/relations-orderer.js
Marc-Roig petersg83
Marc Roig and Pierre Noël
@petersg83 petersg83 Nov 9, 2022
That would be nice indeed :) Not that easy as the order of a Map is not reliable and the current algorithm is relying on the order
Outdated
...e/lib/entity-manager/relations-orderer.js
Marc-Roig
Marc Roig
@petersg83 petersg83 Nov 9, 2022
So much suspense here :O
Outdated
...core/database/lib/entity-manager/index.js
@petersg83 petersg83 Nov 9, 2022
Maybe we need to add `.where(joinTable.on || {})` no?
Outdated
...core/database/lib/entity-manager/index.js
@Marc-Roig Marc-Roig Oct 24, 2022
@petersg83 Do you think we could optimize this ? I would prefer to merge this query with the above one.
Outdated
...core/database/lib/entity-manager/index.js
petersg83
Pierre Noël
Resolved conversations (4)
@petersg83 petersg83 Nov 9, 2022
That was an idea but I think it's cleaner the way it is no?
Outdated
...e/lib/entity-manager/relations-orderer.js
Marc-Roig
Marc Roig
@petersg83 petersg83 Nov 9, 2022
nice name 😊
...core/database/lib/entity-manager/index.js
@joshuaellis joshuaellis Oct 24, 2022
could you just use `.find` here? iirc it breaks the loop once it's found the relation you're after.
Outdated
...se/lib/entity-manager/relationsOrderer.js
joshuaellis Marc-Roig
Josh and Marc Roig
@joshuaellis joshuaellis Oct 24, 2022
Couldn't this potentially break i.e. if your order is 4 but then you update the order twice you're now 3 but something else may think it's order 3? Would it be better to compare the order value of the next & previous relation, find the diff in order value, half that diff and add / subtract from the prev / next relation (respectively)?
Outdated
...se/lib/entity-manager/relationsOrderer.js
Marc-Roig joshuaellis
Marc Roig and Josh