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

allow updates, sorting for new row #714

Merged
merged 10 commits into from May 11, 2022
Merged

allow updates, sorting for new row #714

merged 10 commits into from May 11, 2022

Conversation

nadar
Copy link
Member

@nadar nadar commented May 5, 2022

Prototype for new sorting with custom input and sorting for paginated crud's

$this->on(NgRestModel::EVENT_AFTER_UPDATE, [$this, 'swapIndex']);
}

public function swapIndex(AfterSaveEvent $event)
Copy link

Choose a reason for hiding this comment

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

Method swapIndex has 55 lines of code (exceeds 25 allowed). Consider refactoring.

$this->on(NgRestModel::EVENT_AFTER_UPDATE, [$this, 'swapIndex']);
}

public function swapIndex(AfterSaveEvent $event)
Copy link

Choose a reason for hiding this comment

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

Function swapIndex has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.

var json = {};
json[fieldName] = newPosition;
var pk = $scope.getRowPrimaryValue(row);
$http.put($scope.config.apiEndpoint + '/' + pk +'?ngrestCallType=update&fields='+fieldName, angular.toJson(json, true)).then(() => {
Copy link

Choose a reason for hiding this comment

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

Similar blocks of code found in 2 locations. Consider refactoring.

$this->on(NgRestModel::EVENT_AFTER_UPDATE, [$this, 'swapIndex']);
}

public function swapIndex(AfterSaveEvent $event)
Copy link

Choose a reason for hiding this comment

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

Method swapIndex has 65 lines of code (exceeds 25 allowed). Consider refactoring.

$this->on(NgRestModel::EVENT_AFTER_UPDATE, [$this, 'swapIndex']);
}

public function swapIndex(AfterSaveEvent $event)
Copy link

Choose a reason for hiding this comment

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

Function swapIndex has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.

@nadar
Copy link
Member Author

nadar commented May 5, 2022

  • empty values (submit form without sorting index on create) should be verified

$this->swapIndex($event, true);
}

protected function swapIndex(AfterSaveEvent $event, $isNewRecord = false)
Copy link

Choose a reason for hiding this comment

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

Method swapIndex has 62 lines of code (exceeds 25 allowed). Consider refactoring.

$this->swapIndex($event, true);
}

protected function swapIndex(AfterSaveEvent $event, $isNewRecord = false)
Copy link

Choose a reason for hiding this comment

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

Function swapIndex has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.

* @param boolean $isNewRecord
* @since 4.4.0
*/
protected function updateItemIndex(AfterSaveEvent $event, $isNewRecord = false)
Copy link

Choose a reason for hiding this comment

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

Function updateItemIndex has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.

* @param boolean $isNewRecord
* @since 4.4.0
*/
protected function updateItemIndex(AfterSaveEvent $event, $isNewRecord = false)
Copy link

Choose a reason for hiding this comment

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

Method updateItemIndex has 40 lines of code (exceeds 25 allowed). Consider refactoring.

@codeclimate
Copy link

codeclimate bot commented May 11, 2022

Code Climate has analyzed commit 1296192 and detected 6 issues on this pull request.

Here's the issue category breakdown:

Category Count
Complexity 2
Duplication 4

The test coverage on the diff in this pull request is 69.2% (50% is the threshold).

This pull request will bring the total coverage in the repository to 57.0% (0.1% change).

View more on Code Climate.

@nadar nadar merged commit 5660516 into master May 11, 2022
@nadar nadar deleted the sorting-plugin branch May 11, 2022 09:06
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.

None yet

1 participant