learningequality / learningequality/studio
Run revert using `bulkPut`
Open
@bjester is already working on this.
Since May 11, 2020.
DEV: frontend
P2 - normal
TAG: performance
- Dominant language
- Python
- Stars
- 191
- Forks
- 307
- Avg merge
- 5d 6h
- Merged PRs (30d)
- 10
Description
Summary
See @rtibbles comment here
Suggested update:
const deleteableChanges = changes.filter(change => {
return (
change.type === CHANGE_TYPES.CREATED ||
change.type === CHANGE_TYPES.COPIED ||
(change.type === CHANGE_TYPES.MOVED && !change.oldObj)
);
});
const bulkPutableChanges = changes.filter(change => {
return (
change.type === CHANGE_TYPES.UPDATED ||
change.type === CHANGE_TYPES.DELETED ||
(change.type === CHANGE_TYPES.MOVED && change.oldObj)
);
});
const promises = [];
promises.push(table
.where(table.schema.primKey.keyPath)
.anyOf(deletableChanges.map(change => change.key))
.delete());
promises.push(table.bulkPut(bulkPutableChanges.map(change => change.oldObj)));
return Promise.all(promises);
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.