Skip to content

Commit

Permalink
patched site JSON loader on listen page
Browse files Browse the repository at this point in the history
  • Loading branch information
atruskie committed Nov 30, 2014
1 parent 1548cc7 commit 8862dd1
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/app/listen/listen.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,13 +214,21 @@ angular.module('bawApp.listen', ['decipher.tags', 'ui.bootstrap.typeahead'])
var siteDeferred = $q.defer();
// get site
Site.get({siteId: result.audioRecording.siteId}, {}, function getSiteSuccess(value) {
var data = value.data;
data.links = data.projectIds.map(function(id) {
if (angular.isObject(id)) {
// BUG https://github.com/QutBioacoustics/baw-server/issues/135
id = id.id;
}
else {
console.warn("It would seem https://github.com/QutBioacoustics/baw-server/issues/135 has been fixed, remove me");
}

value.links = value.projectIds.map(function(id) {
return paths.api.routes.site.nestedAbsolute.format({"siteId": value.id, "projectId": id});
return paths.api.routes.site.nestedAbsolute.format({"siteId": data.id, "projectId": id});
});

$scope.model.site = value;
result.site = value;
$scope.model.site = data;
result.site = data;
siteDeferred.resolve(result);
}, function getSiteError() {
siteDeferred.reject("retrieval of site json failed");
Expand Down

0 comments on commit 8862dd1

Please sign in to comment.