You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
deriveReducedPointList(data) where data is the property of the DeliberationContext.
takes: data.pointList and data.groupIdsList and creates/updates data.reducedPointList
groupIds is a list of ids that should be in a group, The first one is the one that should be the point in the reducedPointList object, and the remaining ones should be turned into entries in groupdDocs.
any docs that are in pointList, but not anywhere in any group, should be in reducedPointList with groupeDocs: undefined
the Ids in groupIds can be assumed to all be in pointList. If one is not - log an error and do the best you can. (don't throw errors in production).
If data.pointList and data.groupIdsList have not changed, data.reducedPointList should not change.
If either has changed, create a new version of reducedPointList, then go through each entry and see if the contents have changed. If no changed, then copy the old entry into the new array.
If at the end of comparing old and new, nothing has changed, return the original array.
See derive-review-points for an example, and general discussion of how a "deriver" uses the ref of an object to determine if something has changed, and to indicate if something has changed.
Create jest tests for:
pointList is empty or doesn't exist. (results in an empty array)
groupIdList is empty or doesn't exist. (creates array of object based on point list with grooupedDocs undefined}
pointList has 10 items in it, groupIdList has an array of 2 groups. One with 2 pointIds, one with 3 pointIds.
it is called with no changes to the input
it is called and one of the groups has changed to have one more point in it.
it is called and one of the groups has changed to have one fewer points in it.
it is called and one of the groups has been removed.
it is called, and one of the points in pointList has been updated - so it has a new ref - reducedPointList ref should be changed, and only the ref to the element with the changed point should be changed.
is is called and one of the groups has a new ref, but hasn't actually changed. -- reducedPointList should not change
The text was updated successfully, but these errors were encountered:
deriveReducedPointList(data) where data is the property of the DeliberationContext.
takes: data.pointList and data.groupIdsList and creates/updates data.reducedPointList
groupIds is a list of ids that should be in a group, The first one is the one that should be the point in the reducedPointList object, and the remaining ones should be turned into entries in groupdDocs.
any docs that are in pointList, but not anywhere in any group, should be in reducedPointList with groupeDocs: undefined
the Ids in groupIds can be assumed to all be in pointList. If one is not - log an error and do the best you can. (don't throw errors in production).
If data.pointList and data.groupIdsList have not changed, data.reducedPointList should not change.
If either has changed, create a new version of reducedPointList, then go through each entry and see if the contents have changed. If no changed, then copy the old entry into the new array.
If at the end of comparing old and new, nothing has changed, return the original array.
See derive-review-points for an example, and general discussion of how a "deriver" uses the ref of an object to determine if something has changed, and to indicate if something has changed.
Create jest tests for:
The text was updated successfully, but these errors were encountered: