[Code Style] Rename shadowing variables

This commit is contained in:
Victor Woeltjen
2016-05-20 11:39:49 -07:00
parent e468080373
commit ad5691142e
56 changed files with 256 additions and 262 deletions

View File

@ -68,7 +68,7 @@ define(
}
// Retry persistence (overwrite) for this set of failed attempts
function retry(failures) {
function retry(failuresToRetry) {
var models = {};
// Cache a copy of the model
@ -92,17 +92,17 @@ define(
}
// Cache the object models we might want to save
failures.forEach(cacheModel);
failuresToRetry.forEach(cacheModel);
// Strategy here:
// * Cache all of the models we might want to save (above)
// * Refresh all domain objects (so they are latest versions)
// * Re-insert the cached domain object models
// * Invoke persistence again
return $q.all(failures.map(refresh)).then(function () {
return $q.all(failures.map(remutate));
return $q.all(failuresToRetry.map(refresh)).then(function () {
return $q.all(failuresToRetry.map(remutate));
}).then(function () {
return $q.all(failures.map(persist));
return $q.all(failuresToRetry.map(persist));
});
}
@ -114,8 +114,8 @@ define(
}
// Discard changes associated with a failed save
function discardAll(failures) {
return $q.all(failures.map(discard));
function discardAll(failuresToDiscard) {
return $q.all(failuresToDiscard.map(discard));
}
// Handle user input (did they choose to overwrite?)

View File

@ -57,20 +57,20 @@ define(
failureHandler = this.failureHandler;
// Handle a group of persistence invocations
function persistGroup(ids, persistences, domainObjects, queue) {
function persistGroup(groupIds, persistenceCaps, domainObjs, pQueue) {
var failures = [];
// Try to persist a specific domain object
function tryPersist(id) {
// Look up its persistence capability from the provided
// id->persistence object.
var persistence = persistences[id],
domainObject = domainObjects[id];
var persistence = persistenceCaps[id],
domainObject = domainObjs[id];
// Put a domain object back in the queue
// (e.g. after Overwrite)
function requeue() {
return queue.put(domainObject, persistence);
return pQueue.put(domainObject, persistence);
}
// Handle success
@ -103,7 +103,7 @@ define(
}
// Try to persist everything, then handle any failures
return $q.all(ids.map(tryPersist)).then(handleFailure);
return $q.all(groupIds.map(tryPersist)).then(handleFailure);
}
return persistGroup(ids, persistences, domainObjects, queue);