Skip to content

feat: sort by id desc#8

Merged
zembrowski merged 1 commit into
mainfrom
feat-sort-by-id-desc
Aug 14, 2025
Merged

feat: sort by id desc#8
zembrowski merged 1 commit into
mainfrom
feat-sort-by-id-desc

Conversation

@zembrowski
Copy link
Copy Markdown
Member

Sort by BSI-ID instead of date, to keep the list sorting consistent.

@zembrowski zembrowski self-assigned this Aug 14, 2025
Copilot AI review requested due to automatic review settings August 14, 2025 08:45
@zembrowski zembrowski added the enhancement New feature or request label Aug 14, 2025
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR modifies the sorting behavior to use BSI-ID in descending order instead of date sorting to maintain consistent list ordering. The change updates the URL parameter to sort by title and adds explicit sorting by key in the code.

  • Changes the BSI website URL parameter from sorting by dateOfRevision_dt to title_text_sort in descending order
  • Adds explicit key-based reverse sorting using krsort() with natural sorting
  • Includes a test to verify the retrieved keys are properly sorted in descending order

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
src/Retrieve.php Updates URL sorting parameter and adds krsort() to ensure descending key order
tests/RetrieveTest.php Adds test case to verify retrieved keys are in descending order

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.

Comment thread tests/RetrieveTest.php
Comment thread tests/RetrieveTest.php
/** @noinspection JsonEncodingApiUsageInspection */
expect($keys)->toBe($sorted)
->and(count($keys))->toBe(count($sorted))
->and(array_values($keys))->toBe(array_values($sorted))
Copy link

Copilot AI Aug 14, 2025

Choose a reason for hiding this comment

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

This assertion is redundant since both $keys and $sorted are arrays of keys (not associative arrays). The array_values() call is unnecessary and the assertion duplicates the main comparison on line 62.

Suggested change
->and(array_values($keys))->toBe(array_values($sorted))

Copilot uses AI. Check for mistakes.
Comment thread tests/RetrieveTest.php
@zembrowski zembrowski merged commit 1f0edf8 into main Aug 14, 2025
20 checks passed
@zembrowski zembrowski deleted the feat-sort-by-id-desc branch August 14, 2025 08:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Development

Successfully merging this pull request may close these issues.

2 participants