Skip to content

Commit

Permalink
bug(annotationLibrary) hotfix for #168
Browse files Browse the repository at this point in the history
  • Loading branch information
atruskie committed Jan 24, 2015
1 parent 181abe6 commit 04bb4ad
Showing 1 changed file with 19 additions and 13 deletions.
32 changes: 19 additions & 13 deletions src/app/annotationLibrary/annotationLibrary.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
var baw = window.baw = window.baw || {};

function dontRenameKeys(key) {
return key;
}

baw.annotationLibrary = {};
baw.annotationLibrary.addCalculatedProperties = function addCalculatedProperties(audioEvent, $url, paths) {

Expand All @@ -10,32 +14,32 @@ baw.annotationLibrary.addCalculatedProperties = function addCalculatedProperties
audioEvent.calcOffsetEnd = (Math.floor(audioEvent.startTimeSeconds / 30) * 30) + 30;

audioEvent.urls = {
site: $url.formatUri(paths.api.links.siteAbsolute, {projectId: audioEvent.projects[0].id, siteId: audioEvent.siteId}),
user: $url.formatUri(paths.api.links.userAccountsAbsolute, {userId: audioEvent.ownerId}),
tagSearch: $url.formatUri(paths.site.ngRoutes.library, {tagsPartial: audioEvent.priorityTag.text}),
site: $url.formatUri(paths.api.links.siteAbsolute, {projectId: audioEvent.projects[0].id, siteId: audioEvent.siteId}, dontRenameKeys),
user: $url.formatUri(paths.api.links.userAccountsAbsolute, {userId: audioEvent.ownerId}, dontRenameKeys),
tagSearch: $url.formatUri(paths.site.ngRoutes.library, {tagsPartial: audioEvent.priorityTag.text}, dontRenameKeys),
similar: $url.formatUri(paths.site.ngRoutes.library,
{
annotationDuration: Math.round10(audioEvent.annotationDuration, -3),
freqMin: Math.round(audioEvent.lowFrequencyHertz),
freqMax: Math.round(audioEvent.highFrequencyHertz)
}),
}, dontRenameKeys),
singleItem: $url.formatUri(paths.site.ngRoutes.libraryItem,
{
recordingId: audioEvent.audioRecordingId,
audioEventId: audioEvent.audioEventId
}),
}, dontRenameKeys),
listen: $url.formatUri(paths.site.ngRoutes.listen,
{
recordingId: audioEvent.audioRecordingId,
start: audioEvent.calcOffsetStart,
end: audioEvent.calcOffsetEnd
}),
}, dontRenameKeys),
listenWithoutPadding: $url.formatUri(paths.site.ngRoutes.listen,
{
recordingId: audioEvent.audioRecordingId,
start: audioEvent.startTimeSeconds,
end: audioEvent.endTimeSeconds
})
}, dontRenameKeys)
};

return audioEvent;
Expand Down Expand Up @@ -133,7 +137,7 @@ angular.module('bawApp.annotationLibrary', ['bawApp.configuration'])
loadFilter();

$scope.setFilter = function setFilter() {
$location.path('/library').search($url.toKeyValue($scope.filterSettings, true));
$location.path('/library').search($url.toKeyValue($scope.filterSettings, true, dontRenameKeys));
};

$scope.clearFilter = function clearFilter() {
Expand All @@ -155,7 +159,7 @@ angular.module('bawApp.annotationLibrary', ['bawApp.configuration'])


$scope.createFilterUrl = function createFilterUrl(paramObj) {
return $url.formatUri(paths.site.ngRoutes.libraryAbsolute,paramObj);
return $url.formatUri(paths.site.ngRoutes.libraryAbsolute,paramObj, dontRenameKeys);
};

function getEmptyFilterSettings() {
Expand Down Expand Up @@ -318,7 +322,8 @@ angular.module('bawApp.annotationLibrary', ['bawApp.configuration'])
{
recordingId: $scope.annotation.paging.nextEvent.audioRecordingId,
audioEventId: $scope.annotation.paging.nextEvent.audioEventId
}
},
dontRenameKeys
);
}

Expand All @@ -329,19 +334,20 @@ angular.module('bawApp.annotationLibrary', ['bawApp.configuration'])
{
recordingId: $scope.annotation.paging.prevEvent.audioRecordingId,
audioEventId: $scope.annotation.paging.prevEvent.audioEventId
}
},
dontRenameKeys
);
}
}, function annotationShowError(httpResponse) {
console.error('Failed to load library single item response.', parameters, httpResponse);
});

$scope.createFilterUrl = function createFilterUrl(paramObj) {
return $url.formatUri(paths.site.ngRoutes.libraryAbsolute,paramObj);
return $url.formatUri(paths.site.ngRoutes.libraryAbsolute,paramObj, dontRenameKeys);
};

$scope.createProjectUrl = function createProjectUrl(projectId){
return $url.formatUri(paths.api.links.projectAbsolute, {projectId: projectId});
return $url.formatUri(paths.api.links.projectAbsolute, {projectId: projectId}, dontRenameKeys);
};

}]);

0 comments on commit 04bb4ad

Please sign in to comment.