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

"Add to Google Calendar" button uses wrong times #167

Open
SebKuzminsky opened this issue Jul 11, 2018 · 12 comments
Open

"Add to Google Calendar" button uses wrong times #167

SebKuzminsky opened this issue Jul 11, 2018 · 12 comments
Assignees
Labels

Comments

@SebKuzminsky
Copy link

Expected Behavior

On a shift page, I expect the "Add to Google Calendar" button to create a calendar event at the time of the start of the pickup window.

Actual Behavior

The "Add to Google Calendar" button opens Google Calendar with many fields filled out with useful information, but the times are wrong. In the page linked below, the shift's pickup time is between 4:30PM and 6:00PM, but the calendar even is scheduled for 10:30AM to 12:00PM

I don't know if this problem is specific to that shift, or a general issue.

Steps to Recreate

  1. Go to this shift page: https://robot.boulderfoodrescue.org/schedule_chains/776
  2. Observe the pickup time.
  3. Click on the "Add to Google Calendar" button.
  4. Observe the pre-set calendar event times.

Environment

Chrome on Linux, but I don't think that matters.

@phyninja
Copy link

phyninja commented Sep 9, 2020

Hi @SebKuzminsky,
I'm no expert at software development, but having experienced this issue myself, I'm going to try and fix it.
From just looking closely at the issue, I have realized that the issue originates from the fact that Google Calendar interprets the times on the schedule page as being formatted in UTC. I confirmed this by:

  1. Clicking on the 'Time Zone' button next to the time details on the Google Calendar event, and
  2. Changing the 'Primary Time Zone' on Google Calendar by navigating to Calendar Settings (gear icon on the top right of the page) > General > Time Zone.

This link explains how Google Calendar events are created to account for Time Zone differences.

@phyninja
Copy link

phyninja commented Sep 9, 2020

Example href being used to create calendar event (separated into lines based on arguments):

a href="https://www.google.com/calendar/event?action=TEMPLATE

&text= Food%20Rescue%3A%20Whole%20Foods%20Alpine%20Ideal%20Market%20-%3E%20BHP%20%40%20Broadway%20East

&dates=20200909T090000Z/20200909T103000Z

&details=%2AThis%20shift%20is%20picking%20up%20from%20Ideal%20and%20delivering%20to%20two%20communities.%20Please%20split%20the%20delivery%20between%20Broadway%20East%20and%20Broadway%20West%20while%20you%20are%20sorting.%20For%20Broadway%20East%20you%20can%20give%20half%20of%20the%20produce%20and%20baked%20goods.%20And%20for%20Broadway%20West%20you%20can%20set%20aside%20half%20of%20the%20produce%2C%20half%20the%20baked%20goods%2C%20and%20all%20of%20the%20prepared%20food.%20Please%20deliver%20to%20Broadway%20West%20first.%20%0D%0AIf%20you%20have%20any%20questions%20please%20reach%20out%20to%20the%20volunteer%20line%20before%20the%20shift%3A%20%28970%29%20736-7237%2A%0D%0APlease%20remember%20that%20the%20volunteer%20line%20is%20responsive%20from%208am-6pm%2C%20and%20a%20BFR%20team%20member%20will%20respond%20to%20your%20message%20within%20that%20time%20window%2C%20if%20a%20message%20is%20sent%20before%20or%20after%20the%20window%2C%20it%20will%20be%20responded%20to%20once%20the%20line%20is%20being%20managed%20again.%20

&location=1275%20Alpine%20Avenue%20%20Boulder%2C%20CO%2080304

&trp=true

&sprop=http%3A%2F%2Fboulderfoodrescue.org

&sprop=name:Boulder%20Food%20Rescue

" target="_blank"

Next steps: Figure out where the 'dates' argument is pulling data from.

  • Prepare a Dev environment using the guide in the project's README page
  • Explore the options available for the 'Admin Volunteer' role in setting times for schedules

@rylanb
Copy link
Collaborator

rylanb commented Sep 11, 2020

@phyninja let me know if you get stuck on this, happy to work on fixing this one.

@phyninja
Copy link

Hi @rylanb,

Currently, I'm following the instructions on the project's README page to set up the dev environment. Running the command bundle exec bin/setup gives me the following error:

/Users//.rvm/rubies/ruby-2.3.7/bin/ruby
==> Installing dependencies
/Users//.rvm/gems/ruby-2.3.7@bfr-food-robot/bin/bundle
Could not find sass-3.4.22 in any of the sources
Run bundle install to install missing gems.
Could not find sass-3.4.22 in any of the sources
Run bundle install to install missing gems.

Any thoughts or suggestions you may have on this is welcome.

@rylanb
Copy link
Collaborator

rylanb commented Sep 27, 2020

Ahh this is likely due to a deprecation in the sass library after they've moved over to the C library (sassc) instead of Ruby version.

I'm struggling to get this app running again locally w/ openssl and Ruby 2.3.7 or 2.3.8.

You could try updating the Gemfile locally to

gem 'bootstrap-sass', '~> 3.4.0'
gem 'coffee-rails', '~> 3.2.1'
gem 'font-awesome-sass', '~> 4.6.0'

and then running
bundle update

You may have to do bundle update therubyracer too.

Let me know how that goes!

@rylanb
Copy link
Collaborator

rylanb commented Sep 27, 2020

Ok you can try puling master down now and perhaps it will work? We are on an old version of rails and older gems, so its a bit tricky walking that line. Hopefully that fixes it for you!

@rylanb
Copy link
Collaborator

rylanb commented Sep 27, 2020

Ok, I think I figured this out, sorry to snatch it from you but I got into the rabbit hole of the time zones.

Let me know how it works and reopen if not fixed for you!

@phyninja
Copy link

Hi @rylanb,

No worries, thanks for your time. It appears as though the issue may not yet be resolved, however. Please see the screenshots below:

Schedule chain page:
Schedule_chain_186

Google Calendar Event:
Googlel_calendar_event

URL:
https://www.google.com/calendar/event?action=TEMPLATE&text=Boulder%20Food%20Rescue%3A%20Sprouts%20Market%3A%20%20Arapahoe%20-%3E%20BHP%20%40%20Tantra&dates=20201002T093000Z/20201002T123000Z&details=&location=2525%20Arapahoe%20Avenue%20%20Boulder%2C%20CO%2080302&trp=true&sprop=http%3A%2F%2Fboulderfoodrescue.org&sprop=name:Boulder%20Food%20Rescue

Google Calendar - general settings:
Google Calendar - General Settings

Google Calendar - "my calendar" settings:
Google Calendar - My Calendar Settings

@rylanb rylanb reopened this Sep 29, 2020
@rylanb
Copy link
Collaborator

rylanb commented Sep 29, 2020

@phyninja
Copy link

phyninja commented Oct 4, 2020

Ok, I may have stumbled across a hint:
I'm currently located in India. My system's locale is therefore set to IST (Indian Standard Time, UTC +5:30). In other words, this is the time on my Operating System. My google calendar's time zone was set to Mountain Time - Denver (UTC -6:00) for testing.
If I were to say that the 'Add to Google Calendar' button looks at the time on the 'Schedule Chain' page from the perspective of the user's system time when generating the calendar URL, wouldn't I be on the right track?

@rylanb
Copy link
Collaborator

rylanb commented Oct 4, 2020

You might be. The URL is generated in the backend and should be using UTC time ... but the server is set to use Mountain Time by default (see production.rb). I got a bit confused trying to sort that out.

So, you might be on the right track, but it feels like its something in the add to calendar link -> google calendar and your system time being injected somehow? I wouldn't even know how to troubleshoot that. I just set my system time to IST and clicked the link and it still showed the right time.

@phyninja
Copy link

I ran a few tests on the dev and prod environments by only changing the Time Zone on my Google Calendar.
Log:

Env Case System Time Google Cal Time Zone Time Zone on Robot Home page Sched_chain Event time Expected Google Cal event Actual Google Cal Event
Dev 1 UTC +5:30 UTC +5:30 "+5:30" 4 April 28th, 12PM - 1PM April 28th, 12PM - 1PM April 28th, 12PM - 1PM
Dev 2 UTC +5:30 UTC -6:00 "+5:30" 4 April 28th, 12PM - 1PM April 28th, 12:30AM - 1:30AM April 28th, 12:30AM - 1:30AM
Dev 3 UTC +5:30 UTC +5:30 "+5:30" 6 April 24th, 4PM - 6PM April 24th, 4PM - 6PM April 24th, 4PM - 6PM
Dev 4 UTC +5:30 UTC -6:00 "+5:30" 6 April 24th, 4PM - 6PM April 24th, 4:30AM - 6:30AM April 24th, 4:30AM - 6:30AM
Prod 5 UTC +5:30 UTC +5:30 "+5:30" 1648 April 26th, 9AM - 11AM April 26th, 8:30PM - 10:30PM April 26th, 9AM - 11AM
Prod 6 UTC +5:30 UTC -6:00 "+5:30" 1648 April 26th, 9AM - 11AM April 26th, 9AM - 11AM April 25th, 9:30PM - 11:30PM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants