Skip to content

Commit

Permalink
fix(citizenScienceLabels): changed labels model structure to allow mu…
Browse files Browse the repository at this point in the history
…ltiple examples as array
  • Loading branch information
peichins committed Feb 9, 2017
1 parent 1c4afe7 commit ea6683f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
12 changes: 6 additions & 6 deletions src/app/citizenScience/bristlebird/bristlebird.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,23 +61,23 @@ class BristlebirdController {
$scope.labels = [{
"tags": ["ebb", "type1"],
"label": "Eastern Bristlebird",
"example": {
"examples": [{
"annotationId": 12121
}
}]
},
{
"tags": ["ground_parrot", "type1"],
"label": "Ground Parrot",
"example": {
"examples": [{
"annotationId": 12122
}
}]
},
{
"tags": ["quoll", "type1"],
"label": "Spotted Quoll",
"example": {
"examples": [{
"annotationId": 12123
}
}]
}];

self.getSamples = CitizenScienceCommon.bindGetSamples($scope);
Expand Down
14 changes: 7 additions & 7 deletions src/app/citizenScience/labels/citizenScienceLabels.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,20 +44,20 @@ angular.module("bawApp.components.citizenScienceLabels", ["bawApp.citizenScience
};

/**
* given an array of arrays "containingArray", and an array "arr",
* given an array of arrays "outerArray", and an array "arr",
* returns the index of containingArray that matches arr
*/
self.indexOfArray = function (containingArray, arr) {
self.indexOfArray = function (outerArray, arr) {
var i,j,curSame;
arr = arr.sort();
for (i = 0; i < containingArray.length; i++) {
if(arr.length !== containingArray[i].length) {
for (i = 0; i < outerArray.length; i++) {
if(arr.length !== outerArray[i].length) {
continue;
}
containingArray[i] = containingArray[i].sort();
outerArray[i] = outerArray[i].sort();
curSame = true;
for(j = arr.length; j--;) {
if(arr[j] !== containingArray[i][j]) {
if(arr[j] !== outerArray[i][j]) {
curSame = false;
break;
}
Expand All @@ -71,7 +71,7 @@ angular.module("bawApp.components.citizenScienceLabels", ["bawApp.citizenScience
};

/**
* Whether the all tags in the label have been attached to the current sample
* Whether the label has been attached to the current sample
* @param label Object
* @returns Boolean
*/
Expand Down

0 comments on commit ea6683f

Please sign in to comment.