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

SL-150 #3130

Merged
merged 17 commits into from
Jul 31, 2024
Merged

SL-150 #3130

merged 17 commits into from
Jul 31, 2024

Conversation

lucatume
Copy link
Contributor

@lucatume lucatume commented Jul 24, 2024

Ticket: SL-150

Related PR on service

This PR udpates the code to handle the seat type and reservation updates following a layout edit operation.

Demos:

  1. Changing a seat type name
  2. Changing a seat type color
  3. Assigning seats to diff. seat types

@lucatume lucatume self-assigned this Jul 24, 2024
Copy link
Contributor

@tec-bot tec-bot left a comment

Choose a reason for hiding this comment

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

Remaining comments which cannot be posted as a review comment to avoid GitHub Rate Limit

phpcs

[phpcs] reported by reviewdog 🐶
NormalizedArrays.Arrays.CommaAfterLast.MissingMultiLine
There should be a comma after the last array item in a multi-line array.

'error' => 'Invalid request body'


[phpcs] reported by reviewdog 🐶
SlevomatCodingStandard.Arrays.TrailingArrayComma.MissingTrailingComma
Multi-line arrays must have a trailing comma after the last element.

'error' => 'Invalid request body'

Copy link
Contributor

@tec-bot tec-bot left a comment

Choose a reason for hiding this comment

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

Remaining comments which cannot be posted as a review comment to avoid GitHub Rate Limit

phpcs

[phpcs] reported by reviewdog 🐶
Generic.WhiteSpace.DisallowSpaceIndent.SpacesUsed
Tabs must be used to indent lines; spaces are not allowed


[phpcs] reported by reviewdog 🐶
NormalizedArrays.Arrays.CommaAfterLast.MissingMultiLine
There should be a comma after the last array item in a multi-line array.

'error' => 'Invalid request body'


[phpcs] reported by reviewdog 🐶
SlevomatCodingStandard.Arrays.TrailingArrayComma.MissingTrailingComma
Multi-line arrays must have a trailing comma after the last element.

'error' => 'Invalid request body'


[phpcs] reported by reviewdog 🐶
WordPress.PHP.YodaConditions.NotYoda
Use Yoda Condition checks, you must.

if ( $updated_seat_types === false ) {


[phpcs] reported by reviewdog 🐶
NormalizedArrays.Arrays.CommaAfterLast.MissingMultiLine
There should be a comma after the last array item in a multi-line array.

'error' => 'Failed to update the seat types from the service.'


[phpcs] reported by reviewdog 🐶
SlevomatCodingStandard.Arrays.TrailingArrayComma.MissingTrailingComma
Multi-line arrays must have a trailing comma after the last element.

'error' => 'Failed to update the seat types from the service.'


[phpcs] reported by reviewdog 🐶
NormalizedArrays.Arrays.CommaAfterLast.MissingMultiLine
There should be a comma after the last array item in a multi-line array.

'error' => 'Nonce verification failed'


[phpcs] reported by reviewdog 🐶
SlevomatCodingStandard.Arrays.TrailingArrayComma.MissingTrailingComma
Multi-line arrays must have a trailing comma after the last element.

'error' => 'Nonce verification failed'


[phpcs] reported by reviewdog 🐶
Generic.Formatting.MultipleStatementAlignment.NotSameWarning
Equals sign not aligned with surrounding assignments; expected 4 spaces but found 1 space

$body = $this->get_request_body();


[phpcs] reported by reviewdog 🐶
NormalizedArrays.Arrays.CommaAfterLast.MissingMultiLine
There should be a comma after the last array item in a multi-line array.

'error' => 'Invalid request body'


[phpcs] reported by reviewdog 🐶
SlevomatCodingStandard.Arrays.TrailingArrayComma.MissingTrailingComma
Multi-line arrays must have a trailing comma after the last element.

'error' => 'Invalid request body'


[phpcs] reported by reviewdog 🐶
NormalizedArrays.Arrays.CommaAfterLast.MissingMultiLine
There should be a comma after the last array item in a multi-line array.

'error' => 'Invalid request body'


[phpcs] reported by reviewdog 🐶
SlevomatCodingStandard.Arrays.TrailingArrayComma.MissingTrailingComma
Multi-line arrays must have a trailing comma after the last element.

'error' => 'Invalid request body'


[phpcs] reported by reviewdog 🐶
Generic.WhiteSpace.DisallowSpaceIndent.SpacesUsed
Tabs must be used to indent lines; spaces are not allowed

Seat_Types_Table::truncate() !== false;


[phpcs] reported by reviewdog 🐶
Squiz.Commenting.FunctionComment.Missing
Missing doc comment for function __construct()

public function __construct( array $post_types ) {


[phpcs] reported by reviewdog 🐶
Universal.WhiteSpace.PrecisionAlignment.Found
Found precision alignment of 3 spaces.

->get_ids( true ) as $post_id


[phpcs] reported by reviewdog 🐶
Generic.WhiteSpace.DisallowSpaceIndent.SpacesUsed
Tabs must be used to indent lines; spaces are not allowed

->get_ids( true ) as $post_id


[phpcs] reported by reviewdog 🐶
Universal.Operators.DisallowStandalonePostIncrementDecrement.PostIncrementFound
Stand-alone post-increment statement found. Use pre-increment instead: ++$total_updated .


[phpcs] reported by reviewdog 🐶
Generic.WhiteSpace.IncrementDecrementSpacing.SpaceAfterIncrement
Expected no spaces between $total_updated and the increment operator; 1 found


[phpcs] reported by reviewdog 🐶
NormalizedArrays.Arrays.CommaAfterLast.FoundSingleLine
A comma after the last array item in a single-line array is not allowed.


[phpcs] reported by reviewdog 🐶
NormalizedArrays.Arrays.CommaAfterLast.FoundSingleLine
A comma after the last array item in a single-line array is not allowed.

[ 'id' => $layout_id, ],


[phpcs] reported by reviewdog 🐶
NormalizedArrays.Arrays.CommaAfterLast.FoundSingleLine
A comma after the last array item in a single-line array is not allowed.


[phpcs] reported by reviewdog 🐶
NormalizedArrays.Arrays.CommaAfterLast.FoundSingleLine
A comma after the last array item in a single-line array is not allowed.


[phpcs] reported by reviewdog 🐶
Squiz.Classes.SelfMemberReference.NotUsed
Must use "self::" for local static member reference

Layouts::invalidate_cache( false );


[phpcs] reported by reviewdog 🐶
Generic.WhiteSpace.DisallowSpaceIndent.SpacesUsed
Tabs must be used to indent lines; spaces are not allowed


[phpcs] reported by reviewdog 🐶
Universal.Operators.DisallowStandalonePostIncrementDecrement.PostIncrementFound
Stand-alone post-increment statement found. Use pre-increment instead: ++$total_updated .


[phpcs] reported by reviewdog 🐶
Generic.WhiteSpace.IncrementDecrementSpacing.SpaceAfterIncrement
Expected no spaces between $total_updated and the increment operator; 1 found


[phpcs] reported by reviewdog 🐶
Squiz.Strings.DoubleQuoteUsage.NotRequired
String "UPDATE %i SET name = %s, seats = %d WHERE id = %s" does not require double quotes; use single quotes instead

"UPDATE %i SET name = %s, seats = %d WHERE id = %s",


[phpcs] reported by reviewdog 🐶
WordPress.PHP.YodaConditions.NotYoda
Use Yoda Condition checks, you must.

if ( $updated === false ) {


[phpcs] reported by reviewdog 🐶
WordPress.WhiteSpace.ControlStructureSpacing.NoSpaceAfterStructureOpen
Space after opening control structure is required


[phpcs] reported by reviewdog 🐶
WordPress.WhiteSpace.ControlStructureSpacing.NoSpaceBeforeOpenParenthesis
No space before opening parenthesis is prohibited


[phpcs] reported by reviewdog 🐶
Squiz.ControlStructures.ControlSignature.SpaceAfterKeyword
Expected 1 space after IF keyword; 0 found


[phpcs] reported by reviewdog 🐶
Universal.Operators.DisallowStandalonePostIncrementDecrement.PostIncrementFound
Stand-alone post-increment statement found. Use pre-increment instead: ++$total_updated .


[phpcs] reported by reviewdog 🐶
Generic.WhiteSpace.IncrementDecrementSpacing.SpaceAfterIncrement
Expected no spaces between $total_updated and the increment operator; 1 found

Copy link
Contributor

@tec-bot tec-bot left a comment

Choose a reason for hiding this comment

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

Remaining comments which cannot be posted as a review comment to avoid GitHub Rate Limit

phpcs

[phpcs] reported by reviewdog 🐶
Universal.WhiteSpace.PrecisionAlignment.Found
Found precision alignment of 3 spaces.

->get_ids( true ) as $post_id


[phpcs] reported by reviewdog 🐶
Generic.WhiteSpace.DisallowSpaceIndent.SpacesUsed
Tabs must be used to indent lines; spaces are not allowed

->get_ids( true ) as $post_id


[phpcs] reported by reviewdog 🐶
Universal.Operators.DisallowStandalonePostIncrementDecrement.PostIncrementFound
Stand-alone post-increment statement found. Use pre-increment instead: ++$total_updated .


[phpcs] reported by reviewdog 🐶
Generic.WhiteSpace.IncrementDecrementSpacing.SpaceAfterIncrement
Expected no spaces between $total_updated and the increment operator; 1 found


[phpcs] reported by reviewdog 🐶
NormalizedArrays.Arrays.CommaAfterLast.FoundSingleLine
A comma after the last array item in a single-line array is not allowed.


[phpcs] reported by reviewdog 🐶
NormalizedArrays.Arrays.CommaAfterLast.FoundSingleLine
A comma after the last array item in a single-line array is not allowed.

[ 'id' => $layout_id, ],


[phpcs] reported by reviewdog 🐶
NormalizedArrays.Arrays.CommaAfterLast.FoundSingleLine
A comma after the last array item in a single-line array is not allowed.


[phpcs] reported by reviewdog 🐶
NormalizedArrays.Arrays.CommaAfterLast.FoundSingleLine
A comma after the last array item in a single-line array is not allowed.


[phpcs] reported by reviewdog 🐶
Generic.WhiteSpace.DisallowSpaceIndent.SpacesUsed
Tabs must be used to indent lines; spaces are not allowed


[phpcs] reported by reviewdog 🐶
Universal.Operators.DisallowStandalonePostIncrementDecrement.PostIncrementFound
Stand-alone post-increment statement found. Use pre-increment instead: ++$total_updated .


[phpcs] reported by reviewdog 🐶
Generic.WhiteSpace.IncrementDecrementSpacing.SpaceAfterIncrement
Expected no spaces between $total_updated and the increment operator; 1 found


[phpcs] reported by reviewdog 🐶
Squiz.Strings.DoubleQuoteUsage.NotRequired
String "UPDATE %i SET name = %s, seats = %d WHERE id = %s" does not require double quotes; use single quotes instead

"UPDATE %i SET name = %s, seats = %d WHERE id = %s",


[phpcs] reported by reviewdog 🐶
WordPress.PHP.YodaConditions.NotYoda
Use Yoda Condition checks, you must.

if ( $updated === false ) {


[phpcs] reported by reviewdog 🐶
WordPress.WhiteSpace.ControlStructureSpacing.NoSpaceAfterStructureOpen
Space after opening control structure is required


[phpcs] reported by reviewdog 🐶
WordPress.WhiteSpace.ControlStructureSpacing.NoSpaceBeforeOpenParenthesis
No space before opening parenthesis is prohibited


[phpcs] reported by reviewdog 🐶
Squiz.ControlStructures.ControlSignature.SpaceAfterKeyword
Expected 1 space after IF keyword; 0 found


[phpcs] reported by reviewdog 🐶
Universal.Operators.DisallowStandalonePostIncrementDecrement.PostIncrementFound
Stand-alone post-increment statement found. Use pre-increment instead: ++$total_updated .


[phpcs] reported by reviewdog 🐶
Generic.WhiteSpace.IncrementDecrementSpacing.SpaceAfterIncrement
Expected no spaces between $total_updated and the increment operator; 1 found

@lucatume lucatume marked this pull request as ready for review July 30, 2024 10:05
@rafsuntaskin rafsuntaskin added the needs artifact A screencast, screenshot, or other artifact is needed before merging. label Jul 30, 2024
@lucatume lucatume removed the needs artifact A screencast, screenshot, or other artifact is needed before merging. label Jul 30, 2024

$total_updated = 0;

$ticketable_post_types = (array) tribe_get_option( 'ticket-enabled-post-types', [] );
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's use this maybe:

public function post_types() {

Co-authored-by: Rafsun Chowdhury <rafsun.aiub@gmail.com>
*/
export async function handleReservationsUpdatedFollowingSeatTypes(updated) {
if (!updated || Object.keys(updated).length === 0) {
return 0;
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
return 0;
return false;

@lucatume lucatume merged commit 70d8209 into feat/slr-support Jul 31, 2024
10 of 14 checks passed
@lucatume lucatume deleted the slr/sl-150 branch July 31, 2024 11:53
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.

3 participants