diff --git a/imports/api/Subscriptions/Subscriptions.js b/imports/api/Subscriptions/Subscriptions.js index e1840e1..373c015 100644 --- a/imports/api/Subscriptions/Subscriptions.js +++ b/imports/api/Subscriptions/Subscriptions.js @@ -42,7 +42,8 @@ Subscriptions.schema = new SimpleSchema({ 'location.lat': Number, 'location.lon': Number, distance: Number, - owner: String + owner: String, + type: String }); Subscriptions.attachSchema(Subscriptions.schema); diff --git a/imports/api/Subscriptions/methods.js b/imports/api/Subscriptions/methods.js index 0fda5be..d5e7c62 100644 --- a/imports/api/Subscriptions/methods.js +++ b/imports/api/Subscriptions/methods.js @@ -9,9 +9,10 @@ Meteor.methods({ location: Match.ObjectIncluding({ lat: Number, lon: Number }), distance: Number }); + const type = 'web'; try { - return Subscriptions.insert({ owner: this.userId, ...doc }); + return Subscriptions.insert({ owner: this.userId, type, ...doc }); } catch (exception) { throw new Meteor.Error('500', exception); } diff --git a/imports/api/Subscriptions/server/publications.js b/imports/api/Subscriptions/server/publications.js index fe33282..d3d9ed8 100644 --- a/imports/api/Subscriptions/server/publications.js +++ b/imports/api/Subscriptions/server/publications.js @@ -18,21 +18,24 @@ Meteor.publishTransformed('userSubsToFires', function transform() { const location = doc.location; /* doc.lat = location.lat; * doc.lon = location.lon; */ + let lat; + let lon; if (location) { - doc.lat = Math.round(location.lat * 10) / 10; - doc.lon = Math.round(location.lon * 10) / 10; + lat = Math.round(location.lat * 10) / 10; + lon = Math.round(location.lon * 10) / 10; + // console.log(`[${lat}, ${lon}]`); + const noiseBase = Perlin.perlin2(lat, lon); + const noise = Math.abs(noiseBase / 3); + // console.log(`Noise ${noise}, abs: ${Math.abs(noise)}`); + lat += noise; + lon += noise; + doc.location.lat = lat; + doc.location.lon = lon; + doc.distance += noiseBase; } - // console.log(`[${doc.lat}, ${doc.lon}]`); - const noiseBase = Perlin.perlin2(doc.lat, doc.lon); - const noise = Math.abs(noiseBase / 3); - // console.log(`Noise ${noise}, abs: ${Math.abs(noise)}`); - doc.lat += noise; - doc.lon += noise; - doc.distance += noiseBase; // console.log(`with noise: [${doc.lat}, ${doc.lon}]`); delete doc.chatId; delete doc.geo; - delete doc.location; return doc; }); }); diff --git a/imports/startup/client/i18n.js b/imports/startup/client/i18n.js index a96010e..e2846d1 100644 --- a/imports/startup/client/i18n.js +++ b/imports/startup/client/i18n.js @@ -5,6 +5,9 @@ import LngDetector from 'i18next-browser-languagedetector'; import Cache from 'i18next-localstorage-cache'; import { T9n } from 'meteor-accounts-t9n'; import moment from 'moment'; +import 'moment/locale/es'; +import 'moment/locale/pt'; +import 'moment/locale/gl'; import i18nOpts from '../common/i18n'; // Adapted from: https://github.com/appigram/ryfma-boilerplate/blob/44c1eabfb9928b5623afab36a23997969e5beb02/imports/startup/client/i18n.js @@ -61,6 +64,8 @@ i18n.use(backend) T9n.setLanguage(i18n.language); // console.log(T9n.get('error.accounts.User not found')); + moment.locale(i18n.language); + // cookies eu consent const cookiesOpt = { cookieTitle: t('Uso de Cookies'), diff --git a/imports/ui/components/AuthenticatedNavigation/AuthenticatedNavigation.js b/imports/ui/components/AuthenticatedNavigation/AuthenticatedNavigation.js index c575dbe..b98ec58 100644 --- a/imports/ui/components/AuthenticatedNavigation/AuthenticatedNavigation.js +++ b/imports/ui/components/AuthenticatedNavigation/AuthenticatedNavigation.js @@ -16,12 +16,12 @@ import NavItem from '../NavItem/NavItem'; const AuthenticatedNavigation = ({ name, history, props }) => (