Skip to content

Commit 79cb75e

Browse files
committed
1 parent 24e3063 commit 79cb75e

File tree

4 files changed

+49
-13
lines changed

4 files changed

+49
-13
lines changed

grails-app/assets/javascripts/entities.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ var entities = (function () {
377377
function saveSpecies(data, dataFieldName, outputName, projectActivityId) {
378378
console.log("in addSpecies");
379379
if (data.length === 0) {
380-
return;
380+
return data;
381381
}
382382

383383
data.forEach(function (item) {
@@ -534,8 +534,7 @@ var entities = (function () {
534534
var offset = 0, deferred = $.Deferred(), counter = 1, total = 100;
535535

536536
function fetchNext(data) {
537-
data = data || [];
538-
if (data.length == SPECIES_MAX_FETCH) {
537+
if (!data || (data.length == SPECIES_MAX_FETCH)) {
539538
onlineGetSpeciesForProjectActivityAndFieldInOutput(offset, projectActivityId, dataFieldName, outputName, SPECIES_MAX_FETCH).then(function (result) {
540539
callback(total, counter);
541540
counter = (counter + 1) % total;

package-lock.json

+44-7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"@turf/convex": "^6.0.2",
2222
"@turf/length": "^6.0.2",
2323
"@turf/simplify": "^5.1.5",
24-
"chromedriver": "123.0.1",
24+
"chromedriver": "^125.0.3",
2525
"geojson2svg": "^1.2.3",
2626
"handlebars": "^4.7.7",
2727
"jasmine-ajax": "^4.0.0",

src/test/js/spec/EntitiesSpec.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -634,7 +634,7 @@ describe("Entities", function () {
634634
};
635635

636636
jasmine.Ajax.stubRequest(fcConfig.fetchSpeciesUrl + "?projectActivityId=1&dataFieldName=species1&output=output1&limit=20&q=&offset=0").andReturn({
637-
"responseText": '{"autoCompleteList": [{"commonName": "species1", "scientificName": "sc1", "name": "sc1", "listId": "123", "projectActivityId": "1", "dataFieldName": "species1", "outputName": "output1"}, {"commonName": "species2", "scientificName": "sc1", "name": "sc1", "listId": "123", "projectActivityId": "1", "dataFieldName": "species1", "outputName": "output1"}]}',
637+
"responseText": '{"autoCompleteList": [{"commonName": "species1", "scientificName": "sc1", "name": "sc1", "listId": "123", "projectActivityId": "1", "dataFieldName": "species1", "outputName": "output1"}, {"commonName": "species2", "scientificName": "sc1", "name": "sc1", "listId": "123", "projectActivityId": "1", "dataFieldName": "species1", "outputName": "output1"}, {"commonName": "species2", "scientificName": "sc1", "name": "sc1", "listId": "123", "projectActivityId": "1", "dataFieldName": "species1", "outputName": "output1"}, {"commonName": "species2", "scientificName": "sc1", "name": "sc1", "listId": "123", "projectActivityId": "1", "dataFieldName": "species1", "outputName": "output1"}, {"commonName": "species2", "scientificName": "sc1", "name": "sc1", "listId": "123", "projectActivityId": "1", "dataFieldName": "species1", "outputName": "output1"}, {"commonName": "species2", "scientificName": "sc1", "name": "sc1", "listId": "123", "projectActivityId": "1", "dataFieldName": "species1", "outputName": "output1"}, {"commonName": "species2", "scientificName": "sc1", "name": "sc1", "listId": "123", "projectActivityId": "1", "dataFieldName": "species1", "outputName": "output1"}, {"commonName": "species2", "scientificName": "sc1", "name": "sc1", "listId": "123", "projectActivityId": "1", "dataFieldName": "species1", "outputName": "output1"}, {"commonName": "species2", "scientificName": "sc1", "name": "sc1", "listId": "123", "projectActivityId": "1", "dataFieldName": "species1", "outputName": "output1"}, {"commonName": "species2", "scientificName": "sc1", "name": "sc1", "listId": "123", "projectActivityId": "1", "dataFieldName": "species1", "outputName": "output1"}, {"commonName": "species2", "scientificName": "sc1", "name": "sc1", "listId": "123", "projectActivityId": "1", "dataFieldName": "species1", "outputName": "output1"}, {"commonName": "species2", "scientificName": "sc1", "name": "sc1", "listId": "123", "projectActivityId": "1", "dataFieldName": "species1", "outputName": "output1"},{"commonName": "species2", "scientificName": "sc1", "name": "sc1", "listId": "123", "projectActivityId": "1", "dataFieldName": "species1", "outputName": "output1"} ,{"commonName": "species2", "scientificName": "sc1", "name": "sc1", "listId": "123", "projectActivityId": "1", "dataFieldName": "species1", "outputName": "output1"} , {"commonName": "species2", "scientificName": "sc1", "name": "sc1", "listId": "123", "projectActivityId": "1", "dataFieldName": "species1", "outputName": "output1"}, {"commonName": "species2", "scientificName": "sc1", "name": "sc1", "listId": "123", "projectActivityId": "1", "dataFieldName": "species1", "outputName": "output1"},{"commonName": "species2", "scientificName": "sc1", "name": "sc1", "listId": "123", "projectActivityId": "1", "dataFieldName": "species1", "outputName": "output1"}, {"commonName": "species2", "scientificName": "sc1", "name": "sc1", "listId": "123", "projectActivityId": "1", "dataFieldName": "species1", "outputName": "output1"}, {"commonName": "species2", "scientificName": "sc1", "name": "sc1", "listId": "123", "projectActivityId": "1", "dataFieldName": "species1", "outputName": "output1"}, {"commonName": "species2", "scientificName": "sc1", "name": "sc1", "listId": "123", "projectActivityId": "1", "dataFieldName": "species1", "outputName": "output1"}]}',
638638
"status": 200,
639639
"contentType": "application/json"
640640
});
@@ -656,7 +656,7 @@ describe("Entities", function () {
656656
entities.searchSpecies(1, "species1", "output1", {q: ""}, 20).then(resolve, reject);
657657
});
658658
});
659-
expect(result.autoCompleteList.length).toBe(2);
659+
expect(result.autoCompleteList.length).toBe(20);
660660
}, 10000);
661661

662662
it("should search all species if species from species list is empty", async function () {

0 commit comments

Comments
 (0)