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

Camptix: Notify: Add attended segment #288

Open
wants to merge 1 commit into
base: production
Choose a base branch
from
Open

Camptix: Notify: Add attended segment #288

wants to merge 1 commit into from

Conversation

CdrMarks
Copy link
Collaborator

Can now segment attendees by if they attended the event.
Fixes #280.

Reattempt after feedback on #281.

Copy link
Contributor

@ryelle ryelle left a comment

Choose a reason for hiding this comment

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

I left a few code style changes (you should be able to merge those from the github UI, if you want), and one comment about the switch statement, that one's up to you :)

'key' => 'tix_attended',
'value' => 1,
);
switch ( $condition['op'] ) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This block might be more readable as an if/else statement - what do you think?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, I saw the others– I also think those would be more readable as if/else, but no, I wouldn't touch those in this PR. It's okay if this one looks different, the idea is to iteratively make this code better, not refactor everything all at once.

if ( empty( $condition['field'] ) || empty( $condition['op'] ) )
continue;

if ( "attended" != $condition['field'] && ! isset( $condition['value'] ) )
Copy link
Contributor

Choose a reason for hiding this comment

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

Some PHP code style nitpicks: this should use single quotes around attended, and use strict comparisons:

Suggested change
if ( "attended" != $condition['field'] && ! isset( $condition['value'] ) )
if ( 'attended' !== $condition['field'] && ! isset( $condition['value'] ) )

@@ -3460,6 +3470,26 @@ public function get_segment( $relation, $conditions ) {
$post_query_conditions[] = $condition;
continue;
}

// Attended the event
if ( 'attended' == $condition['field'] ) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Again, this should use a strict comparison:

Suggested change
if ( 'attended' == $condition['field'] ) {
if ( 'attended' === $condition['field'] ) {

@ryelle ryelle added the [Component] CampTix Including addons label Nov 25, 2019
@ryelle
Copy link
Contributor

ryelle commented Jan 15, 2020

Hey @CdrMarks, are you still working on this issue? Let me know if you'd like to me to take it over and merge it 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Component] CampTix Including addons
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CampTix: Notify: Can't send notification message to just people that attended WordCamp
3 participants