Skip to content
Snippets Groups Projects
Commit 059c3c37 authored by Marc Vachon's avatar Marc Vachon
Browse files

new member mail

parent 65b7bb40
No related branches found
No related tags found
No related merge requests found
......@@ -20,7 +20,7 @@ module.exports = {
<p>Pour rejoindre le rendez-vous il suffit d'entrer le code sur la page d'accueil du site.</p>
<p>Une fois sur la page du rendez-vous il suffit d'appuyez sur le bouton "ajouter un membre" et
d'entrer le informations pour ajouter une personne.</p>
d'entrer les informations.</p>
<p>Cordialement</p>
......@@ -55,9 +55,34 @@ module.exports = {
})
})
},
new_member: (idMeeting, data) => {
let sub = "MEETUS: Bien arrivé"
var msg = `
<p>Vous venez d'ajouter un compte au rendez-vous <b>${idMeeting}</b>.</p>
<p>Les informations du compte</p>
<p><b>Nom</b> ${data.name}</p>
<p><b>Email</b> ${data.email}</p>
<p><b>Ville</b> ${data.address}</p>
<b>Calendar</b>
<ul>
${data.calendar.map(date => `<li>${date.day}/${date.month}/${date.year} from: ${date.from.hour}:${date.from.minutes} to: ${date.to.hour}:${date.to.minutes}</li>`)}
</ul>
}
<p>Cordialement</p>
<p>L'équipe technique de Meetus</p>
`
send(data.email, sub, msg).catch(console.error);
}
}
......
......@@ -178,7 +178,7 @@ function choose_new_point(point){
}
function validate_city(idMeeting, city_to, date){
var maxDiff = 60, diff, tableTimes = [], time
var maxDiff = 60, diff = 0, tableTimes = [], time, sum = 0, avg = 0
return new Promise(function(res, rej){
......@@ -210,18 +210,20 @@ function validate_city(idMeeting, city_to, date){
// wait for all promises to be done
Promise.all(promises).then(function(){
if (tableTimes.length > 1) {
var min = Math.min(...tableTimes)
var max = Math.max(...tableTimes)
var min = Math.min(...tableTimes)
var max = Math.max(...tableTimes)
if(max != min){
diff = max - min
}else{
diff = min
}
if(max != min){
diff = max - min
}else{
diff = min
}
var sum = tableTimes.reduce((previous, current) => current += previous);
var avg = parseInt(sum / tableTimes.length);
sum = tableTimes.reduce((previous, current) => current += previous);
avg = parseInt(sum / tableTimes.length);
}
res({city: city_to, diff: diff, avg: avg});
......
......@@ -23,7 +23,6 @@ module.exports = {
console.log(result);
email.new_meeting(data.email, id)
//console.log("email:", data.email);
callback(id)
})
......@@ -44,6 +43,8 @@ module.exports = {
journey.update_journeys(idMeeting, function(c){
email.new_member(idMeeting, data)
callback(res)
})
})
......@@ -63,6 +64,7 @@ module.exports = {
journey.update_center(idMeeting, function(){
journey.update_journeys(idMeeting, function(){
callback()
})
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment