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

Sweep: Pagination Missing on "Shop Summary" Merchant Table (βœ“ Sandbox Passed) #100

Closed

Conversation

sweep-ai[bot]
Copy link

@sweep-ai sweep-ai bot commented Feb 3, 2024

PR Feedback: πŸ‘Ž

Description

This pull request adds pagination functionality to the "Shop Summary" merchant table. It includes changes to the ShopsController, PaginationHelper, index.html.erb, and routes.rb files.

Summary

  • Added index action to ShopsController to fetch paginated shops
  • Created PaginationHelper module with methods for custom pagination rendering
  • Modified index.html.erb to include pagination for @shops
  • Updated routes.rb to add a route for shops#index with pagination parameter

Fixes #96.


πŸŽ‰ Latest improvements to Sweep:
  • New dashboard launched for real-time tracking of Sweep issues, covering all stages from search to coding.
  • Integration of OpenAI's latest Assistant API for more efficient and reliable code planning and editing, improving speed by 3x.
  • Use the GitHub issues extension for creating Sweep issues directly from your editor.

πŸ’‘ To get Sweep to edit this pull request, you can:

  • Comment below, and Sweep can edit the entire PR
  • Comment on a file, Sweep will only modify the commented file
  • Edit the original issue to get Sweep to recreate the PR from scratch

Copy link
Author

sweep-ai bot commented Feb 3, 2024

Rollback Files For Sweep

  • Rollback changes to app/helpers/pagination_helper.rb
  • Rollback changes to app/controllers/shops_controller.rb
  • Rollback changes to config/routes.rb
  • Rollback changes to app/views/shops/index.html.erb

This is an automated message generated by Sweep AI.


def link_to_previous_page(collection, options)
unless collection.first_page?
link_to 'Previous', url_for(page: collection.prev_page), class: options[:previous_class] || "prev-page"
Copy link
Owner

Choose a reason for hiding this comment

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

[standard] <Style/StringLiterals> reported by reviewdog 🐢
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

Suggested change
link_to 'Previous', url_for(page: collection.prev_page), class: options[:previous_class] || "prev-page"
link_to "Previous", url_for(page: collection.prev_page), class: options[:previous_class] || "prev-page"

Copy link
Author

@sweep-ai sweep-ai bot Feb 3, 2024

Choose a reason for hiding this comment

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

πŸš€ Wrote Changes

Done.

This is an automated message generated by Sweep AI.


def link_to_next_page(collection, options)
unless collection.last_page?
link_to 'Next', url_for(page: collection.next_page), class: options[:next_class] || "next-page"
Copy link
Owner

Choose a reason for hiding this comment

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

[standard] <Style/StringLiterals> reported by reviewdog 🐢
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

Suggested change
link_to 'Next', url_for(page: collection.next_page), class: options[:next_class] || "next-page"
link_to "Next", url_for(page: collection.next_page), class: options[:next_class] || "next-page"

end_page = [collection.current_page + options[:page_range], collection.total_pages].min

(start_page..end_page).map do |page|
link_to page, url_for(page: page), class: (page == collection.current_page ? options[:active_class] : options[:page_class])
Copy link
Owner

Choose a reason for hiding this comment

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

[standard] <Style/TernaryParentheses> reported by reviewdog 🐢
Use parentheses for ternary expressions with complex conditions.

Suggested change
link_to page, url_for(page: page), class: (page == collection.current_page ? options[:active_class] : options[:page_class])
link_to page, url_for(page: page), class: ((page == collection.current_page ? options[:active_class] : options[:page_class])

Copy link
Author

@sweep-ai sweep-ai bot Feb 3, 2024

Choose a reason for hiding this comment

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

πŸš€ Wrote Changes

Done.

This is an automated message generated by Sweep AI.

config/routes.rb Outdated
@@ -18,7 +18,7 @@
resources :summarys, only: [] do
collection do
get :monthly, to: "summarys/monthly#index"
get :shop, to: "summarys/shop#index"
get 'shops/index/(:page)', to: 'shops#index', as: 'shops_index'
Copy link
Owner

Choose a reason for hiding this comment

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

[standard] <Style/StringLiterals> reported by reviewdog 🐢
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

Suggested change
get 'shops/index/(:page)', to: 'shops#index', as: 'shops_index'
get "shops/index/(:page)", to: 'shops#index', as: 'shops_index'

Copy link
Author

@sweep-ai sweep-ai bot Feb 3, 2024

Choose a reason for hiding this comment

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

πŸš€ Wrote Changes

Done.

This is an automated message generated by Sweep AI.

config/routes.rb Outdated
@@ -18,7 +18,7 @@
resources :summarys, only: [] do
collection do
get :monthly, to: "summarys/monthly#index"
get :shop, to: "summarys/shop#index"
get 'shops/index/(:page)', to: 'shops#index', as: 'shops_index'
Copy link
Owner

Choose a reason for hiding this comment

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

[standard] <Style/StringLiterals> reported by reviewdog 🐢
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

Suggested change
get 'shops/index/(:page)', to: 'shops#index', as: 'shops_index'
get 'shops/index/(:page)', to: "shops#index", as: 'shops_index'

config/routes.rb Outdated
@@ -18,7 +18,7 @@
resources :summarys, only: [] do
collection do
get :monthly, to: "summarys/monthly#index"
get :shop, to: "summarys/shop#index"
get 'shops/index/(:page)', to: 'shops#index', as: 'shops_index'
Copy link
Owner

Choose a reason for hiding this comment

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

[standard] <Style/StringLiterals> reported by reviewdog 🐢
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

Suggested change
get 'shops/index/(:page)', to: 'shops#index', as: 'shops_index'
get 'shops/index/(:page)', to: 'shops#index', as: "shops_index"

config/routes.rb Outdated
@@ -18,7 +18,7 @@
resources :summarys, only: [] do
collection do
get :monthly, to: "summarys/monthly#index"
get :shop, to: "summarys/shop#index"
get 'shops/index/(:page)', to: 'shops#index', as: 'shops_index'
Copy link
Owner

Choose a reason for hiding this comment

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

[standard] <Style/StringLiterals> reported by reviewdog 🐢
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

Suggested change
get 'shops/index/(:page)', to: 'shops#index', as: 'shops_index'
get "shops/index/(:page)", to: 'shops#index', as: 'shops_index'

config/routes.rb Outdated
@@ -18,7 +18,7 @@
resources :summarys, only: [] do
collection do
get :monthly, to: "summarys/monthly#index"
get :shop, to: "summarys/shop#index"
get 'shops/index/(:page)', to: 'shops#index', as: 'shops_index'
Copy link
Owner

Choose a reason for hiding this comment

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

[standard] <Style/StringLiterals> reported by reviewdog 🐢
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

Suggested change
get 'shops/index/(:page)', to: 'shops#index', as: 'shops_index'
get "shops/index/(:page)", to: "shops#index", as: 'shops_index'

config/routes.rb Outdated
@@ -18,7 +18,7 @@
resources :summarys, only: [] do
collection do
get :monthly, to: "summarys/monthly#index"
get :shop, to: "summarys/shop#index"
get 'shops/index/(:page)', to: 'shops#index', as: 'shops_index'
Copy link
Owner

Choose a reason for hiding this comment

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

[standard] <Style/StringLiterals> reported by reviewdog 🐢
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

Suggested change
get 'shops/index/(:page)', to: 'shops#index', as: 'shops_index'
get "shops/index/(:page)", to: 'shops#index', as: "shops_index"

Copy link
Author

@sweep-ai sweep-ai bot Feb 3, 2024

Choose a reason for hiding this comment

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

πŸš€ Wrote Changes

Done.

This is an automated message generated by Sweep AI.

end_page = [collection.current_page + options[:page_range], collection.total_pages].min

(start_page..end_page).map do |page|
link_to page, url_for(page: page), class: (page == collection.current_page ? options[:active_class] : options[:page_class])
Copy link
Owner

Choose a reason for hiding this comment

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

[standard] <Style/TernaryParentheses> reported by reviewdog 🐢
Use parentheses for ternary expressions with complex conditions.

Suggested change
link_to page, url_for(page: page), class: (page == collection.current_page ? options[:active_class] : options[:page_class])
link_to page, url_for(page: page), class: (((page == collection.current_page ? options[:active_class] : options[:page_class]))

Copy link
Author

@sweep-ai sweep-ai bot Feb 3, 2024

Choose a reason for hiding this comment

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

πŸš€ Wrote Changes

Done.

This is an automated message generated by Sweep AI.

config/routes.rb Outdated
@@ -18,7 +18,7 @@
resources :summarys, only: [] do
collection do
get :monthly, to: "summarys/monthly#index"
get :shop, to: "summarys/shop#index"
get "shops/index/(:page)", to: 'shops#index', as: 'shops_index'
Copy link
Owner

Choose a reason for hiding this comment

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

[standard] <Style/StringLiterals> reported by reviewdog 🐢
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

Suggested change
get "shops/index/(:page)", to: 'shops#index', as: 'shops_index'
get "shops/index/(:page)", to: "shops#index", as: 'shops_index'

config/routes.rb Outdated
@@ -18,7 +18,7 @@
resources :summarys, only: [] do
collection do
get :monthly, to: "summarys/monthly#index"
get :shop, to: "summarys/shop#index"
get "shops/index/(:page)", to: 'shops#index', as: 'shops_index'
Copy link
Owner

Choose a reason for hiding this comment

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

[standard] <Style/StringLiterals> reported by reviewdog 🐢
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

Suggested change
get "shops/index/(:page)", to: 'shops#index', as: 'shops_index'
get "shops/index/(:page)", to: 'shops#index', as: "shops_index"

end_page = [collection.current_page + options[:page_range], collection.total_pages].min

(start_page..end_page).map do |page|
link_to page, url_for(page: page), class: ((page == collection.current_page ? options[:active_class] : options[:page_class]))
Copy link
Owner

Choose a reason for hiding this comment

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

[standard] <Style/TernaryParentheses> reported by reviewdog 🐢
Use parentheses for ternary expressions with complex conditions.

Suggested change
link_to page, url_for(page: page), class: ((page == collection.current_page ? options[:active_class] : options[:page_class]))
link_to page, url_for(page: page), class: (((page == collection.current_page ? options[:active_class] : options[:page_class]))

end_page = [collection.current_page + options[:page_range], collection.total_pages].min

(start_page..end_page).map do |page|
link_to page, url_for(page: page), class: ((page == collection.current_page ? options[:active_class] : options[:page_class]))
Copy link
Owner

Choose a reason for hiding this comment

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

[standard] <Style/TernaryParentheses> reported by reviewdog 🐢
Use parentheses for ternary expressions with complex conditions.

Suggested change
link_to page, url_for(page: page), class: ((page == collection.current_page ? options[:active_class] : options[:page_class]))
link_to page, url_for(page: page), class: ((((page == collection.current_page ? options[:active_class] : options[:page_class])))

Copy link
Author

@sweep-ai sweep-ai bot Feb 3, 2024

Choose a reason for hiding this comment

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

πŸš€ Wrote Changes

Done.

This is an automated message generated by Sweep AI.

@@ -18,7 +18,7 @@
resources :summarys, only: [] do
collection do
get :monthly, to: "summarys/monthly#index"
get :shop, to: "summarys/shop#index"
get "shops/index/(:page)", to: 'shops#index', as: "shops_index"
Copy link
Owner

Choose a reason for hiding this comment

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

[standard] <Style/StringLiterals> reported by reviewdog 🐢
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

Suggested change
get "shops/index/(:page)", to: 'shops#index', as: "shops_index"
get "shops/index/(:page)", to: "shops#index", as: "shops_index"

end_page = [collection.current_page + options[:page_range], collection.total_pages].min

(start_page..end_page).map do |page|
link_to page, url_for(page: page), class: (((page == collection.current_page ? options[:active_class] : options[:page_class])))
Copy link
Owner

Choose a reason for hiding this comment

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

[standard] <Style/TernaryParentheses> reported by reviewdog 🐢
Use parentheses for ternary expressions with complex conditions.

Suggested change
link_to page, url_for(page: page), class: (((page == collection.current_page ? options[:active_class] : options[:page_class])))
link_to page, url_for(page: page), class: ((((page == collection.current_page ? options[:active_class] : options[:page_class])))

Copy link
Author

@sweep-ai sweep-ai bot Feb 3, 2024

Choose a reason for hiding this comment

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

πŸš€ Wrote Changes

Done.

This is an automated message generated by Sweep AI.

end_page = [collection.current_page + options[:page_range], collection.total_pages].min

(start_page..end_page).map do |page|
link_to page, url_for(page: page), class: ((((page == collection.current_page ? options[:active_class] : options[:page_class]))))
Copy link
Owner

Choose a reason for hiding this comment

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

[standard] <Style/TernaryParentheses> reported by reviewdog 🐢
Use parentheses for ternary expressions with complex conditions.

Suggested change
link_to page, url_for(page: page), class: ((((page == collection.current_page ? options[:active_class] : options[:page_class]))))
link_to page, url_for(page: page), class: (((((page == collection.current_page ? options[:active_class] : options[:page_class]))))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Pagination Missing on "Shop Summary" Merchant Table
1 participant