|
@@ -1,25 +1,29 @@
|
|
|
// import attractivity from '../Attractivity.json';
|
|
// import attractivity from '../Attractivity.json';
|
|
|
-import nuts from '../nuts.js';
|
|
|
|
|
|
|
+// import nuts from '../nuts.js';
|
|
|
import {factors} from './factors.js';
|
|
import {factors} from './factors.js';
|
|
|
|
|
|
|
|
export class AdjusterService {
|
|
export class AdjusterService {
|
|
|
- constructor(HsCore, HsUtilsService, $rootScope, $http) {
|
|
|
|
|
|
|
+ constructor(HsCore, HsUtilsService, $rootScope, $http, $location) {
|
|
|
'ngInject';
|
|
'ngInject';
|
|
|
this.HsCore = HsCore;
|
|
this.HsCore = HsCore;
|
|
|
this.HsUtilsService = HsUtilsService;
|
|
this.HsUtilsService = HsUtilsService;
|
|
|
this.$rootScope = $rootScope;
|
|
this.$rootScope = $rootScope;
|
|
|
this.$http = $http;
|
|
this.$http = $http;
|
|
|
|
|
+ this.serviceBaseUrl =
|
|
|
|
|
+ $location.host() === 'localhost'
|
|
|
|
|
+ ? 'https://jmacura.ml/ws/'
|
|
|
|
|
+ : 'https://publish.lesprojekt.cz/nodejs/';
|
|
|
this.factors = factors;
|
|
this.factors = factors;
|
|
|
this.nutsCodeRecordRelations = {};
|
|
this.nutsCodeRecordRelations = {};
|
|
|
- this.init();
|
|
|
|
|
|
|
+ this.apply();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
apply() {
|
|
apply() {
|
|
|
const f = () => {
|
|
const f = () => {
|
|
|
this.$http({
|
|
this.$http({
|
|
|
- method: 'post',
|
|
|
|
|
- url: 'https://publish.lesprojekt.cz/nodejs/scores',
|
|
|
|
|
- data: {
|
|
|
|
|
|
|
+ method: 'get',
|
|
|
|
|
+ url: this.serviceBaseUrl + 'clusters',
|
|
|
|
|
+ /*data: {
|
|
|
factors: this.factors.map((f) => {
|
|
factors: this.factors.map((f) => {
|
|
|
return {
|
|
return {
|
|
|
factor: f.factor,
|
|
factor: f.factor,
|
|
@@ -29,11 +33,12 @@ export class AdjusterService {
|
|
|
.map((ds) => ds.name),
|
|
.map((ds) => ds.name),
|
|
|
};
|
|
};
|
|
|
}),
|
|
}),
|
|
|
- },
|
|
|
|
|
|
|
+ },*/
|
|
|
}).then((response) => {
|
|
}).then((response) => {
|
|
|
- this.attractivity = response.data;
|
|
|
|
|
- let max = 0;
|
|
|
|
|
- this.attractivity.forEach((a) => {
|
|
|
|
|
|
|
+ this.clusters = response.data.response;
|
|
|
|
|
+ console.log(this.clusters);
|
|
|
|
|
+ /*let max = 0;
|
|
|
|
|
+ this.clusters.forEach((a) => {
|
|
|
if (a.aggregate > max) {
|
|
if (a.aggregate > max) {
|
|
|
max = a.aggregate;
|
|
max = a.aggregate;
|
|
|
}
|
|
}
|
|
@@ -67,15 +72,15 @@ export class AdjusterService {
|
|
|
).toFixed(2)
|
|
).toFixed(2)
|
|
|
);
|
|
);
|
|
|
});
|
|
});
|
|
|
- });
|
|
|
|
|
|
|
+ });*/
|
|
|
});
|
|
});
|
|
|
};
|
|
};
|
|
|
this.HsUtilsService.debounce(f, 300)();
|
|
this.HsUtilsService.debounce(f, 300)();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- init() {
|
|
|
|
|
|
|
+ /*init() {
|
|
|
this.$http({
|
|
this.$http({
|
|
|
- url: 'https://publish.lesprojekt.cz/nodejs/datasets',
|
|
|
|
|
|
|
+ url: this.serviceBaseUrl + 'datasets',
|
|
|
}).then((response) => {
|
|
}).then((response) => {
|
|
|
this.factors = response.data.map((dataset) => {
|
|
this.factors = response.data.map((dataset) => {
|
|
|
return {factor: dataset.Factor, weight: 1, datasets: []};
|
|
return {factor: dataset.Factor, weight: 1, datasets: []};
|
|
@@ -96,5 +101,5 @@ export class AdjusterService {
|
|
|
});
|
|
});
|
|
|
this.apply();
|
|
this.apply();
|
|
|
});
|
|
});
|
|
|
- }
|
|
|
|
|
|
|
+ }*/
|
|
|
}
|
|
}
|