Fix for firestats increased by one
This commit is contained in:
parent
88a3eb9639
commit
de73daba32
2 changed files with 9 additions and 5 deletions
|
|
@ -35,8 +35,7 @@ const activefires = (northEastLng, northEastLat, southWestLng, southWestLat, wit
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// console.log(JSON.stringify(result));
|
if (Meteor.isDevelopment) console.log(`Active fires total: ${fires.count()}`);
|
||||||
// console.log(`Fires total: ${fires.count()}`);
|
|
||||||
|
|
||||||
if (withMarks && fires.fetch().length > 0) {
|
if (withMarks && fires.fetch().length > 0) {
|
||||||
const union = firesUnion(fires);
|
const union = firesUnion(fires);
|
||||||
|
|
@ -59,6 +58,7 @@ Meteor.publish('activefiresmyloc', function activeInMyLoc(northEastLng, northEas
|
||||||
return activefires(northEastLng, northEastLat, southWestLng, southWestLat, withMarks);
|
return activefires(northEastLng, northEastLat, southWestLng, southWestLat, withMarks);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Warning: this increase always by one the fire stats
|
||||||
Meteor.publish('lastFireDetected', function lastFireDetected() {
|
Meteor.publish('lastFireDetected', function lastFireDetected() {
|
||||||
return ActiveFires.find({}, { limit: 1, sort: { when: -1 } });
|
return ActiveFires.find({}, { limit: 1, sort: { when: -1 } });
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -200,8 +200,10 @@ class FiresMap extends React.Component {
|
||||||
console.log(`Rendering ${this.props.loading ? 'loading' : 'LOADED'}, zoom ${this.state.viewport.zoom}, map ${this.props.activefires.length + this.props.firealerts.length} of ${this.props.activefirestotal} total. False positives: ${this.props.falsePositives.length}. Reactive ${this.state.viewport.zoom >= MAXZOOMREACTIVE}`);
|
console.log(`Rendering ${this.props.loading ? 'loading' : 'LOADED'}, zoom ${this.state.viewport.zoom}, map ${this.props.activefires.length + this.props.firealerts.length} of ${this.props.activefirestotal} total. False positives: ${this.props.falsePositives.length}. Reactive ${this.state.viewport.zoom >= MAXZOOMREACTIVE}`);
|
||||||
const title = `${t('AppName')}: ${t('Fuegos activos')}`;
|
const title = `${t('AppName')}: ${t('Fuegos activos')}`;
|
||||||
|
|
||||||
|
if (Meteor.isDevelopment && this.props.activefires.length === 1) console.log(`Active fire: ${JSON.stringify(this.props.activefires[0])}`);
|
||||||
|
if (Meteor.isDevelopment) console.log(`Active fires total: ${this.props.activefires.length}`);
|
||||||
if (Meteor.isDevelopment) console.log(`False positives total: ${this.props.falsePositives.length}`);
|
if (Meteor.isDevelopment) console.log(`False positives total: ${this.props.falsePositives.length}`);
|
||||||
|
if (Meteor.isDevelopment) console.log(`Fire alerts total: ${this.props.firealerts.length}`);
|
||||||
if (Meteor.isDevelopment) console.log(`Industries total: ${this.props.industries.length}`);
|
if (Meteor.isDevelopment) console.log(`Industries total: ${this.props.industries.length}`);
|
||||||
|
|
||||||
if (!this.state.init) {
|
if (!this.state.init) {
|
||||||
|
|
@ -403,7 +405,8 @@ export default translate([], { wait: true })(withTracker(() => {
|
||||||
if (typeof showUnionStored === 'boolean') {
|
if (typeof showUnionStored === 'boolean') {
|
||||||
showUnion.set(showUnionStored);
|
showUnion.set(showUnionStored);
|
||||||
}
|
}
|
||||||
Meteor.subscribe('lastFireDetected');
|
// Disable, because this increase the number of fires by one
|
||||||
|
// Meteor.subscribe('lastFireDetected');
|
||||||
Meteor.autorun(() => {
|
Meteor.autorun(() => {
|
||||||
if ((centerStored !== [0, 0] || geolocation.get()) && geoInit) {
|
if ((centerStored !== [0, 0] || geolocation.get()) && geoInit) {
|
||||||
center.set(centerStored || geolocation.get());
|
center.set(centerStored || geolocation.get());
|
||||||
|
|
@ -447,6 +450,7 @@ export default translate([], { wait: true })(withTracker(() => {
|
||||||
const fireAlerts = FireAlertsCollection.find().fetch();
|
const fireAlerts = FireAlertsCollection.find().fetch();
|
||||||
const falsePositives = FalsePositivesCollection.find().fetch().map(falsePositivesRemap);
|
const falsePositives = FalsePositivesCollection.find().fetch().map(falsePositivesRemap);
|
||||||
const industries = IndustriesCollection.find().fetch().map(industriesRemap);
|
const industries = IndustriesCollection.find().fetch().map(industriesRemap);
|
||||||
|
const lastFireDetected = ActiveFiresCollection.findOne({}, { sort: { when: -1 } });
|
||||||
|
|
||||||
return {
|
return {
|
||||||
loading: !subscription ? true : !(subscription.ready() && settingsSubs.ready() && alertSubscription.ready()),
|
loading: !subscription ? true : !(subscription.ready() && settingsSubs.ready() && alertSubscription.ready()),
|
||||||
|
|
@ -460,7 +464,7 @@ export default translate([], { wait: true })(withTracker(() => {
|
||||||
falsePositives,
|
falsePositives,
|
||||||
industries,
|
industries,
|
||||||
lastCheck: lastCheck ? lastCheck.value : null,
|
lastCheck: lastCheck ? lastCheck.value : null,
|
||||||
lastFireDetected: ActiveFiresCollection.findOne({}, { sort: { when: -1 } }),
|
lastFireDetected,
|
||||||
center: center.get(),
|
center: center.get(),
|
||||||
marks: marks.get(),
|
marks: marks.get(),
|
||||||
showUnion: showUnion.get(),
|
showUnion: showUnion.get(),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue