Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing age calculation in 5.1.3 #190

Closed
JaapAntwerp opened this issue Nov 24, 2022 · 19 comments
Closed

Missing age calculation in 5.1.3 #190

JaapAntwerp opened this issue Nov 24, 2022 · 19 comments
Assignees
Labels
bug Related to a bug or a critical problem in the code.

Comments

@JaapAntwerp
Copy link

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

  • Version of the script: x.x.x - look for a line near the top of the code which
    reads:

    version: 'w.x.y-z',
  • Any other details which might be related to the 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
Copy link
Collaborator

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
Copy link
Author

JaapAntwerp commented Nov 24, 2022 via email

@JaapAntwerp
Copy link
Author

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

@plainerman plainerman added the bug Related to a bug or a critical problem in the code. label Nov 28, 2022
@plainerman plainerman self-assigned this Nov 28, 2022
@plainerman
Copy link
Collaborator

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

The issue seems to be

if (settings.notifications.eventTypes.CUSTOM) {
googleContact.getEvents().forEach(processEvent);
}

@plainerman
Copy link
Collaborator

plainerman commented Nov 28, 2022

Could you check if the changes proposed here: #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

testDate: new Date('2017/08/01 06:00:00')

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
Copy link
Author

JaapAntwerp commented Nov 28, 2022 via email

@plainerman
Copy link
Collaborator

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

@plainerman plainerman changed the title set-up for 5.1.3 Missing age calculation in 5.1.3 Nov 28, 2022
@JaapAntwerp
Copy link
Author

no, still no age calculation

How do I share my "config" ???

@plainerman
Copy link
Collaborator

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
Copy link
Author

var settings = {
user: {
/*
* GOOGLE EMAIL ADDRESS
*
* Replace this fake Gmail address with the Gmail (or G Suite/Google Apps) address of your
* own Google Account. This is needed to retrieve information about your contacts.
/
googleEmail: '[email protected]',
/

* NOTIFICATION EMAIL ADDRESS
*
* Replace this fake email address with the one you want the notifications to be sent
* to. This can be the same email address as 'googleEmail' on or any other email
* address. Non-Gmail addresses are fine as well.
/
notificationEmail: '[email protected]',
/

* EMAIL SENDER NAME
*
* This is the name you will see as the sender of the email: if you leave it blank it will
* default to your Google account name.
* Note: this may not work when notificationEmail is a Gmail address.
/
emailSenderName: '(verjaardags) kalender van xxxxxxxxxx',
/

* LANGUAGE
*
* To translate the notifications messages into your language enter the two-letter language
* code here.
* Available languages are:
* en, cs, de, el, es, fa, fr, he, id, it, kr, lt, nl, no, nb, pl, pt, pt-BR, ru, th, tr.
* If you want to add your own language find the variable called i18n below and follow the
* instructions: it's quite simple as long as you can translate from one of the available
* languages.
/
lang: 'nl'
},
notifications: {
/

* HOUR OF THE NOTIFICATION
*
* Specify at which hour of the day would you like to receive the email notifications.
* This must be an integer between 0 and 23. This will set and automatic trigger for
* the script between e.g. 6 and 7 am.
/
hour: 0,
/

* NOTIFICATION TIMEZONE
*
* To ensure the correctness of the notifications timing please set this variable to the
* timezone you are living in.
* Accepted values:
* GMT (e.g. 'GMT-4', 'GMT+6')
* regional timezones (e.g. 'Europe/Berlin' - See here for a complete list: http://joda-time.sourceforge.net/timezones.html)
/
timeZone: 'Europe/Rome',
/

* HOW MANY DAYS BEFORE EVENT
*
* Here you have to decide when you want to receive the email notification.
* Insert a comma-separated list of numbers between the square brackets, where each number
* represents how many days before an event you want to be notified.
* If you want to be notified only once then enter a single number between the brackets.
*
* Examples:
* [0] means "Notify me the day of the event";
* [0, 7] means "Notify me the day of the event and 7 days before";
* [0, 1, 7] means "Notify me the day of the event, the day before and 7 days before";
*
* Note: in any case you will receive one email per day: all the notifications will be grouped
* together in that email.
/
anticipateDays: [0, 1, 7],
/

* TYPE OF EVENTS
*
* This script can track any Google Contact Event: you can decide which ones by placing true
* or false next to each type in the following lines.
* By default the script only tracks birthday events.
/
eventTypes: {
BIRTHDAY: true,
ANNIVERSARY: true,
CUSTOM: true
},
/

* MAXIMUM NUMBER OF EMAIL ADDRESSES
*
* You can limit the maximum number of email addresses displayed for each contact in the notification emails
* by changing this number. If you don't want to impose any limits change it to -1, if you don't want any
* email address to be shown change it to 0.
/
maxEmailsCount: -1,
/

* MAXIMUM NUMBER OF PHONE NUMBERS
*
* You can limit the maximum number of phone numbers displayed for each contact in the notification emails
* by changing this number. If you don't want to impose any limits change it to -1, if you don't want any
* phone number to be shown change it to 0.
/
maxPhonesCount: -1,
/

* INDENT SIZE
*
* Use this variable to determine how many spaces are used for indentation.
* This is used in the plaintext part of emails only (invisible to email clients which display
* the html part by default).
/
indentSize: 4,
/

* GROUP ALL LABELS
*
* By default only the main emails and phone numbers (work, home, mobile, main) are displayed with their
* own label: all the other special and/or custom emails and phone numbers are grouped into a single
* "other" group. By setting this variable to false instead, every phone and email will be grouped
* under its own label.
/
compactGrouping: true
},
debug: {
log: {
/

* LOGGING FILTER LEVEL
*
* This settings lets you filter which type of events will get logged:
* - 'INFO' will log all types of events event (messages, warnings and errors);
* - 'WARNING' will log warnings and errors only (discarding messages);
* - 'ERROR' will log errors only (discarding messages and warnings);
* - 'FATAL_ERROR' will log fatal errors only (discarding messages, warnings and non-fatal errors);
* - 'MAX' will effectively disable the logging (nothing will be logged);
/
filterLevel: 'INFO',
/

* Set this variable to: 'INFO', 'WARNING', 'ERROR', 'FATAL_ERROR' or 'MAX'. You will be sent an
* email containing the full execution log of the script if at least one event of priority
* equal or greater to sendTrigger has been logged. 'MAX' means that such emails will
* never be sent.
* Note: filterLevel has precedence over this setting! For example if you set filterLevel
* to 'MAX' and sendTrigger to 'WARNING' you will never receive any email as nothing will
* be logged due to the filterLevel setting.
/
sendTrigger: 'ERROR'
},
/

* TEST DATE
*
* When using the test() function this date will be used as "now". The date must be in the
* yyyy/MM/dd HH:mm:ss format.
* Choose a date you know should trigger an event notification.
/
testDate: new Date('2022/11/24 00:00:00')
},
developer: {
/
NB: Users shouldn't need to (or want to) touch these settings. They are here for the
* convenience of developers/maintainers only.
*/
version: '5.1.4',
repoName: 'GioBonvi/GoogleContactsEventsNotifier',
gitHubBranch: 'master'
}
};

@plainerman
Copy link
Collaborator

Great, thank you. I will look into it.

@JaapAntwerp
Copy link
Author

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
Copy link
Author

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
Copy link
Collaborator

plainerman commented Nov 29, 2022

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
Copy link
Author

JaapAntwerp commented Nov 30, 2022 via email

@ekos2001
Copy link

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

@JaapAntwerp
Copy link
Author

JaapAntwerp commented Nov 30, 2022 via email

@plainerman
Copy link
Collaborator

plainerman commented Nov 30, 2022

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 Fix age calculation caused by undefined events #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
Copy link
Author

JaapAntwerp commented Nov 30, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Related to a bug or a critical problem in the code.
Projects
None yet
Development

No branches or pull requests

3 participants