Skip to content

Conversation

@zangjiucheng
Copy link
Member

@zangjiucheng zangjiucheng commented Feb 15, 2025

This pull request introduces several enhancements and new features to the Minerva project, including updates to documentation, additions to the CalendarEvent class, and improvements to event reminders. The most important changes include adding a cancelled status to calendar events, updating the README file with usage and development guides, and modifying event reminders to account for cancelled events.

Documentation Updates:

  • README.md: Added links to usage guides and development onboarding and reference guides for Minerva.

CalendarEvent Class Enhancements:

Event Reminder Improvements:

Test Updates:


This change is Reviewable

@QuantumManiac
Copy link
Member

QuantumManiac commented Feb 15, 2025

Please refer to the repo's CONTRIBUTING.md for details on contributing to minerva, e.g. making feature branches and testing your functionality in the development Slack/GCal. You should ideally not be committing to the development branch directly as you'll be triggering a broken deploy every time you commit to your feature until it's complete.

README.md: Added links to usage guides and development onboarding and reference guides for Minerva.

What did you change? I don't see any changes to it in this PR and they already exist in there anyway.

throw new Error("Event summary is undefined");
}
const title = event.summary;
const cancelled = title.includes("CANCELLED");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit:

  • This should probably be case-insensitive? If not, be sure to explicitly mention it in the documentation

Copy link
Member Author

@zangjiucheng zangjiucheng Feb 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi! This should be case-sensitive by behavior requested :) (But nice checking)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe I should switch to case-insensitve which seems make more sense. Thanks for reminding this!


parsedEvent.location = event.location ?? undefined;
parsedEvent.url = event.htmlLink ?? undefined;
parsedEvent.cancelled = cancelled;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Use the constructor to pass the cancelled status instead (see Line 69)
  • This might be good to do for location and url as well, unless there isn't a good reason to do so

Copy link
Member Author

@zangjiucheng zangjiucheng Feb 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • This is a good idea! I switch to use constructor with is_cancelled.
  • I didn't change location and url, not sure if other behavior on it.

"updated": "2023-12-07T15:33:49.949Z",
"location": "The Bay",
"summary": "Minerva Testing",
"summary": "[CANCELLED] Minerva Testing",
Copy link
Member

@QuantumManiac QuantumManiac Feb 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comment re: unittesting

const calendarEvent = CalendarEvent.fromGoogleCalendarEvent(googleCalendarEvent, slackChannels);
expect(calendarEvent).toEqual({
title: googleCalendarEvent.summary,
cancelled: true,
Copy link
Member

@QuantumManiac QuantumManiac Feb 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comment re: unittesting

const calendarEvent = CalendarEvent.fromGoogleCalendarEvent(calendarEventJson, slackChannels);
expect(calendarEvent).toEqual({
title: googleCalendarEvent.summary,
cancelled: true,
Copy link
Member

@QuantumManiac QuantumManiac Feb 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comment re: unittesting

expect(parseEvents(googleCalendarEvents, slackChannels)).toEqual([
{
title: googleCalendarEvent.summary,
cancelled: true,
Copy link
Member

@QuantumManiac QuantumManiac Feb 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comment re: unittesting

Copy link
Member

@QuantumManiac QuantumManiac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One of my review comments magically disappeared. See below.

"updated": "2023-12-07T15:33:49.949Z",
"location": "The Bay",
"summary": "Minerva Testing",
"summary": "[CANCELLED] Minerva Testing",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You shoud add more unittests to test the cancelled functionality instead of modifying existing ones to test it. Additionally, refrain from modifying the test fixture like this and change the summary to your liking from within the unittest (e.g. calendarEventJson.summary = "[CANCELLED] Minerva Testing" in whatever unittest tests the cancel functionality.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good! Thanks! I am not familiar with this project. Defiantly I will make more test on this project 👍

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done :)

@QuantumManiac
Copy link
Member

Please also update the Documentation for this feature as well.

@zangjiucheng
Copy link
Member Author

Thanks for your detailed review :) I did fix everything, please double check before we merge this to production environment

Copy link
Member

@QuantumManiac QuantumManiac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM so far. Just one more thing that might be nice to have.

Copy link
Member

@QuantumManiac QuantumManiac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some fixing to the wording to the reminder message and you should be good to go.

EDIT: It seems that my code suggestion decided not to be included in the review. See below instead.

The wording still seems a bit awkward when you just append "has been cancelled" to generateEventReminderChannelText. How about:

export function generateEventReminderChannelText(event: CalendarEvent, reminderType: EventReminderType): string {
  let message = `${
    !event.is_cancelled &&
    (reminderType == EventReminderType.FIVE_MINUTES || reminderType == EventReminderType.MANUAL_PING)
      ? "<!channel>\n"
      : ""
  }Reminder: *${event.title}*`;

  let timeUntilEventMessage: string;

  if (reminderType === EventReminderType.FIVE_MINUTES) {
    const timeUntilEvent = event.start.getTime() - new Date().getTime();
    timeUntilEventMessage = ` in *${Math.ceil(timeUntilEvent / 1000 / 60)} minutes*`;
  } else {
    timeUntilEventMessage = ` at *${moment(event.start).tz("America/Toronto").format("MMMM Do, YYYY [at] h:mm A")}*`;
  }

  if (event.is_cancelled) {
    message += ` that was supposed to occur ${timeUntilEventMessage} *has been cancelled*`;
  } else {
    message += ` is occurring ${timeUntilEventMessage}`;
  }
...

Copy link
Member

@QuantumManiac QuantumManiac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@zangjiucheng
Copy link
Member Author

Thanks so much for your review :)

@zangjiucheng zangjiucheng merged commit 9dccc5a into main Feb 20, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants