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

EWPP-1787: Add extra field displaying event status messages. #997

Merged
merged 4 commits into from
Jan 10, 2022

Conversation

22Alexandra
Copy link
Contributor

No description provided.

}

// The event is ongoing but the livestream is yet to start.
if ($this->requestDateTime >= $event->getStartDate()->getPhpDateTime() && $this->requestDateTime < $event->getOnlineStartDate()->getPhpDateTime()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

We will re-use condition often, so EventNodeWrapper is a good place to store it. You can use isOnlinePeriodYetToCome from openeuropa/oe_content#498.

$this->requestDateTime >= $event->getStartDate()->getPhpDateTime() also can be stored in EventNodeWrapper.


// If we have a link for livestream the livestream messages have priority
// over the event status ones.
if (!$entity->get('oe_event_online_link')->isEmpty()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

In the spec there is a point that livestream info should be visible if Online type != None. So it is checked in EWPP-1802. Would be inconsistent to show message here but not to show livestream due to implementation in EWPP-1802.
Screenshot 2021-12-07 at 19 50 38

Or might be we need a single method in EventNodeWrapper that will check all required fields to enable livestream feature.

}

// If the livestream is ongoing, cache it by its end date.
if ($this->requestDateTime >= $event->getOnlineStartDate()->getPhpDateTime()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Also isOnlinePeriodOver() can be used.

// Cache it by the event end date and add the timezone cache contexts.
$build['#title'] = $this->t('The livestream has ended, but the event is ongoing.');
$this->applyHourTag($build, $event->getEndDate());
$cacheable->addCacheContexts(['timezone']);
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
$cacheable->addCacheContexts(['timezone']);

it was added by $this->applyHourTag()

protected $dateFormatter;

/**
* ProgrammeExtraField constructor.
Copy link
Member

Choose a reason for hiding this comment

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

Needs to be fixed.

// If the event is not over then apply time-based tags, so that it can be
// correctly invalidated once the event is over.
if (!$event->isOver($this->requestDateTime)) {
$this->applyHourTag($build, $event->getEndDate());
Copy link
Member

Choose a reason for hiding this comment

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

Logic issue, I set the event as planned with the event dates matching the online dates with event cancelled, the message is correct, but when I set it to Rescheduled, the event shows the message "This event has started. You can also watch it via livestream." even when I set the event state to cancelled or postponed, the message doesn't change, even when I'm logged in as admin or logged out. This is due to the fact that you don't exit here, and it continues until the line 147. Please make sure such case is covered by test after fixing it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We'll need confirmation from PO.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated the logic.


// If we have an online type set the livestream messages have priority
// over the event status ones.
if ($event->hasOnlineType()) {
Copy link
Member

Choose a reason for hiding this comment

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

I think the entity itself should be added as cacheable dependency. Currently the entity is not there.

Comment on lines 176 to 186
$build['#variant'] = 'warning';
$build['#icon'] = 'warning';
if ($event->isPostponed()) {
$build['#title'] = $this->t('This event has been postponed.');
}
if ($event->isCancelled()) {
$build['#title'] = $this->t('This event has been cancelled.');
}
if ($event->isRescheduled()) {
$build['#title'] = $this->t('This event has been rescheduled.');
}
Copy link
Member

Choose a reason for hiding this comment

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

These will be never reached if we have online type and dates set even though the event status is set to one of these.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The livestream messages have priority over these ones, as requested.

Regarding online type/dates/link, according to Evegenii's comment to avoid inconsistency, I'll check the Online type instead of the Online link as requested in the ticket.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed the logic displaying event status messages (if it's not as planned) over livestream ones.

Copy link
Member

@nagyad nagyad left a comment

Choose a reason for hiding this comment

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

I have clarified the logic with the PO. As the ticket says, only "As planned" messages get overruled, not the "postponed", "cancelled" or "rescheduled" cases. Please refactor the logic accordingly.

sergepavle
sergepavle previously approved these changes Jan 6, 2022
imanoleguskiza
imanoleguskiza previously approved these changes Jan 7, 2022
sergepavle
sergepavle previously approved these changes Jan 7, 2022
nagyad
nagyad previously approved these changes Jan 7, 2022
@22Alexandra 22Alexandra merged commit 9472eef into EPIC-EWPP-1539-Event-v2 Jan 10, 2022
@22Alexandra 22Alexandra deleted the EWPP-1787 branch January 10, 2022 07:30
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.

5 participants