GioBonvi / GoogleContactsEventsNotifier

Receive automatic email notifications before your Google Contacts birthday and other events!
MIT License
219 stars 50 forks source link

Missing age calculation in 5.1.3 #190

Closed JaapAntwerp closed 1 year ago

JaapAntwerp commented 2 years ago

Steps to reproduce

I have followed the set-up file and try to add an Google Cloud Project number But helas, it tells me I don't have sufficient rights (I need to configurate the "OAuth consent screen")

I do receive the reminder e-mail, but

1) no age is presented 2) It only gives 1 reminder (not the reminders for over 2 or 7 days) 3) also in the subject, it only gives that one reminder (of today)

What action or series of actions is the cause of the issue?

  1. action 1;
  2. action 2;
  3. action 3;

Expected behavior

What should happen?

Current behavior

What happens instead?

Context

Extended description

Try to describe the problem in the most complete way. You can add images, error messages, hypothesis and observations regarding the problem here.

Possible solution

If you think you know what causes the problem or if you know a solution for it write it here. Cloud platform project Cloud platform project - 2 Cloud platform project - 3

plainerman commented 2 years ago

Hey, thank you for filing this issue. Unfortunately, I am not certain if I understood you correctly. You said that you receive emails, which means that you have setup the script correctly. Regarding the email notifications prior to the events, you have to set anticipateDays in the script accordingly. Did you do that?

The age calculation can be wrong if an incorrect javascript engine is set. Could you go to the script -> click the gear icon on the top left -> and ensure that the Chrome V8-Runtime is activated?

JaapAntwerp commented 2 years ago

Thanks Michael,

First a small correction. It seems the version 5.1.3 did correctly send me also the anticitaped events (for today, and for in 2 days and in 7 days) But it did NOT give the years Nor (as I see now) did it give the teleplhone number (for the anticitated events)

I did set the anticipateDays correctly on 0, 2, 7:

reply - 1

And the V8-runtime was already activated:

reply - 2

"Strange" thing is that I kept the old version (5.0.1) alive and that one works fine (although in another gmail account I have the same problem (no years) for this version)

version 5.0.1:

reply - 3 - version 5 0 1

version 5.1.3: As you can see for Marc Roels (birthday tomorrow 25/11) the e-mails addres is there, but not his telephone number And for non the "years" is calculated (the "91 jaar" you see is part of the contact's name. It is his age at the moment she passed away (then 91 years, today she would have been 98 years)

reply - 4 - version 5 1 3

Groeten,

Jaap

Op do 24 nov. 2022 om 11:08 schreef Michael Plainer < @.***>:

Hey, thank you for filing this issue. Unfortunately, I am not certain if I understood you correctly. You said that you receive emails, which means that you have setup the script correctly. Regarding the email notifications prior to the events, you have to set anticipateDays in the script accordingly. Did you do that?

The age calculation can be wrong if an incorrect javascript engine is set. Could you go to the script -> click the gear icon on the top left -> and ensure that the Chrome V8-Runtime is activated?

— Reply to this email directly, view it on GitHub https://github.com/GioBonvi/GoogleContactsEventsNotifier/issues/190#issuecomment-1326228787, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKBW32Z5DE2GMAJ6DDJGBFDWJ45DFANCNFSM6AAAAAASKA5PO4 . You are receiving this because you authored the thread.Message ID: @.***>

JaapAntwerp commented 2 years ago

Does somebody why I do get the reminder emails, but the age is missing?

plainerman commented 1 year ago

I think that I was able to reproduce this issue. Will keep you posted here.

The issue seems to be https://github.com/GioBonvi/GoogleContactsEventsNotifier/blob/ff969c95c5c9039c68df9858cedee02307e7750e/code.gs#L443-L445

plainerman commented 1 year ago

Could you check if the changes proposed here: https://github.com/GioBonvi/GoogleContactsEventsNotifier/pull/191 resolve your issues?

After updating the script, you can verify it by selecting "test" instead of "notifStart" in the dropdown at the top. When ran, this will execute the script for the set test date. You can change it by setting https://github.com/GioBonvi/GoogleContactsEventsNotifier/blob/ff969c95c5c9039c68df9858cedee02307e7750e/code.gs#L163 to a date where some of your contacts have a birthday.

If this does not solve your problem, please share your settings (line 12-173).

JaapAntwerp commented 1 year ago

No. No change. Still not a calculated age

Have I made the correct changes??

Op ma 28 nov. 2022 om 22:20 schreef Michael Plainer < @.***>:

Could you test if the code here:

191 https://github.com/GioBonvi/GoogleContactsEventsNotifier/pull/191

resolves your issues?

— Reply to this email directly, view it on GitHub https://github.com/GioBonvi/GoogleContactsEventsNotifier/issues/190#issuecomment-1329776935, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKBW324AU4NBNSO5QLAS4CLWKUO2RANCNFSM6AAAAAASKA5PO4 . You are receiving this because you authored the thread.Message ID: @.***>

plainerman commented 1 year ago

Lines 325-330 were deleted. Could you share your config? (please remove your email for privacy reasons)

JaapAntwerp commented 1 year ago

no, still no age calculation

How do I share my "config" ???

plainerman commented 1 year ago

The settings can be found from line 12-173 of your script. With them I can see whether the same issue persists for me.

But as said above, please delete your email from the script.

JaapAntwerp commented 1 year ago

var settings = { user: { /*

plainerman commented 1 year ago

Great, thank you. I will look into it.

JaapAntwerp commented 1 year ago

This is my execution log:

23:06:40 Mededeling Uitvoering gestart 23:06:40 Informatie I: test() running. 23:06:40 Informatie I: main() running. 23:06:40 Informatie I: validateSettings() running. 23:06:41 Informatie I: generateEmailNotification() running. 23:06:41 Informatie I: Date used: Fri Dec 02 2022 00:00:00 GMT+0100 (Central European Standard Time) 23:06:41 Informatie I: Looking for contacts events on Fri Dec 02 2022 00:00:00 GMT+0100 (Central European Standard Time) (2022-12-02T00:00:00+01:00 / 2022-12-02T00:01:00+01:00) 23:06:41 Informatie I: Found: 2 23:06:42 Informatie I: Looking for contacts events on Sat Dec 03 2022 00:00:00 GMT+0100 (Central European Standard Time) (2022-12-03T00:00:00+01:00 / 2022-12-03T00:01:00+01:00) 23:06:43 Informatie I: Found: 0 23:06:43 Informatie I: Looking for contacts events on Fri Dec 09 2022 00:00:00 GMT+0100 (Central European Standard Time) (2022-12-09T00:00:00+01:00 / 2022-12-09T00:01:00+01:00) 23:06:44 Informatie I: Found: 1 23:06:44 Informatie I: Found 3 events. 23:06:44 Informatie I: Extracting info from raw event object... 23:06:44 Informatie I: Extracting info from Google Contact... 23:06:44 Informatie I: Fetching contact info for: d6e9a160bde51a7 23:06:44 Informatie W: People is not defined 23:06:44 Informatie W: Invalid Google Contact ID or error retrieving data for ID: d6e9a160bde51a7 23:06:44 Informatie I: Extracting info from raw event object... 23:06:44 Informatie I: Extracting info from Google Contact... 23:06:44 Informatie I: Fetching contact info for: 3419b9798eb52e2d 23:06:44 Informatie W: People is not defined 23:06:44 Informatie W: Invalid Google Contact ID or error retrieving data for ID: 3419b9798eb52e2d 23:06:44 Informatie I: Extracting info from raw event object... 23:06:44 Informatie I: Extracting info from Google Contact... 23:06:44 Informatie I: Fetching contact info for: ebeeee78d70edc0 23:06:44 Informatie W: People is not defined 23:06:44 Informatie W: Invalid Google Contact ID or error retrieving data for ID: ebeeee78d70edc0 23:06:44 Informatie I: Found 3 contacts with matching events. 23:06:44 Informatie I: Checking birthdays on Friday 02-12-2022 23:06:44 Informatie I: Found 1 birthdays 23:06:44 Informatie I: Checking anniversaries on Friday 02-12-2022 23:06:44 Informatie I: No events found on this date. 23:06:44 Informatie I: Checking custom events on Friday 02-12-2022 23:06:44 Informatie I: Found 1 custom events 23:06:44 Informatie I: Checking birthdays on Saturday 03-12-2022 23:06:44 Informatie I: No events found on this date. 23:06:44 Informatie I: Checking anniversaries on Saturday 03-12-2022 23:06:44 Informatie I: No events found on this date. 23:06:44 Informatie I: Checking custom events on Saturday 03-12-2022 23:06:44 Informatie I: No events found on this date. 23:06:44 Informatie I: Checking birthdays on Friday 09-12-2022 23:06:44 Informatie I: Found 1 birthdays 23:06:44 Informatie I: Checking anniversaries on Friday 09-12-2022 23:06:44 Informatie I: No events found on this date. 23:06:44 Informatie I: Checking custom events on Friday 09-12-2022 23:06:44 Informatie I: No events found on this date. 23:06:44 Informatie I: Building the email notification. 23:06:44 Informatie I: Sending email... 23:06:44 Informatie I: Email sent. 23:06:44 Mededeling Uitvoering voltooid

JaapAntwerp commented 1 year ago

What I don't understand is, while I use as a testDate: new Date('2022/11/24 00:00:00') and anticipateDays: [0, 1, 7],

The log says: 23:06:41 Informatie I: Date used: Fri Dec 02 2022 00:00:00 GMT+0100 (Central European Standard Time)

plainerman commented 1 year ago

Yes, this seems odd to me too. Just to get the obvious out of the way: You saved the script, right?

Secondly, 23:06:44 Informatie W: People is not defined seems weird. Maybe there is something wrong with the people api integration.

JaapAntwerp commented 1 year ago

Yes I saved the script.

I don't know about the integration of the people API, but I do get the emails, only in after version 5.0.2 no longer the calculated age (and in some of my accounts even in version 5.0.2 the calculated age is gone).

Op di 29 nov. 2022 22:52 schreef Michael Plainer @.***>:

Yes, this seems odd to me. Just to get the obvious out of the way: You saved the script, right?

Secondly, 23:06:44 Informatie W: People is not defined seems weird. Maybe there is something wrong with the people api integration.

— Reply to this email directly, view it on GitHub https://github.com/GioBonvi/GoogleContactsEventsNotifier/issues/190#issuecomment-1331369104, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKBW325BGJORBV2IGI3FZSDWKZ3LHANCNFSM6AAAAAASKA5PO4 . You are receiving this because you authored the thread.Message ID: @.***>

ekos2001 commented 1 year ago

I had to add People API to make it working, althought it is not mentioned in the Installation and setup image

JaapAntwerp commented 1 year ago

I actually think that does make a difference.... But it helps only partially (I get some with the calculated date, some without and some double)

But for some odd reason I get now 1 contact with a special event (date of death) mentioned two times:

The only thing still missing (which was there in the previous versions) is the "nickname" of the contact added to the body (as I have an extended family, sometimes in the "nickname" I have put information who is who. eg. "daughter of ...". or "son of .....")

Groeten,

Jaap

Op wo 30 nov. 2022 om 16:41 schreef ekos2001 @.***>:

I had to add People API to make it working, althought it is not mentioned in the Installation and setup https://github.com/GioBonvi/GoogleContactsEventsNotifier/blob/master/docs/install-and-setup.md [image: image] https://user-images.githubusercontent.com/12628077/204842275-6cfeca27-c58c-4cca-ba07-49f488b84fec.png

— Reply to this email directly, view it on GitHub https://github.com/GioBonvi/GoogleContactsEventsNotifier/issues/190#issuecomment-1332364853, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKBW32ZIBGWKNHOR6YMICK3WK5YT5ANCNFSM6AAAAAASKA5PO4 . You are receiving this because you authored the thread.Message ID: @.***>

plainerman commented 1 year ago

Thanks @ekos2001, I have it also activated. But when I implemented the feature in #177, it seemed like we don't need to manually activate it. That might have changed, or was not working properly for new users.

@JaapAntwerp regarding this issue: 1) Have you included the changes from #191? Because those should also resolve the duplicate / missing age calculations. 2) Regarding the nick names, lets create a second issue 3) I will document the people api and also create a separate issue for that.

JaapAntwerp commented 1 year ago

I have re-started everything, re-copied the original code, made the changes, activated the People API and YES, IT WORKS !!!

And I even copied it to my other gmails accounts, and (again) YES, IT WORKS !!!!

Thanks

Groeten,

Jaap

Op wo 30 nov. 2022 om 18:18 schreef Michael Plainer < @.***>:

Thanks @ekos2001 https://github.com/ekos2001, I have it also activated. But when I implemented the feature in #177 https://github.com/GioBonvi/GoogleContactsEventsNotifier/pull/177, it seemed like we don't need to manually activate it. That might have changed, or was not working properly for new users.

@JaapAntwerp https://github.com/JaapAntwerp regarding this issue:

  1. Have you included the changes from #191 https://github.com/GioBonvi/GoogleContactsEventsNotifier/pull/191? Because those should also resolve the duplicate / missing code calculations.
  2. Regarding the nick names, lets create a second issue
  3. I will document the people api and also create a separate issue for that.

— Reply to this email directly, view it on GitHub https://github.com/GioBonvi/GoogleContactsEventsNotifier/issues/190#issuecomment-1332492791, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKBW323T3AQMIBFZYSSGLDDWK6D5FANCNFSM6AAAAAASKA5PO4 . You are receiving this because you were mentioned.Message ID: @.***>