Skip to content

feature: add bulk update #3695

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

Open
wants to merge 31 commits into
base: main
Choose a base branch
from
Open

Conversation

Nevelito
Copy link
Contributor

@Nevelito Nevelito commented Feb 26, 2025

Description

Add bulk update to app

Changes:

  1. create new controller
  2. adjust the code in edit resource component to handle normal edit and update and bulk edit
  3. make changes in base controller to handle bulk update and fix codeclimat errors
  4. add new routes
  5. add new function to url_halpers.rb to handle bulk update
  6. adjust item_select_all_controller.js to handle adding resource ids to Bulk update button
  7. add locales
  8. add system specs

Fixes # (issue)
#3679

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works

Screenshots & recording

Screencast.from.12.03.2025.20.44.54.webm

Copy link

codeclimate bot commented Feb 26, 2025

Code Climate has analyzed commit 9ae1366 and detected 2 issues on this pull request.

Here's the issue category breakdown:

Category Count
Complexity 2

View more on Code Climate.

@Nevelito Nevelito changed the title [WIP] feature: add bulk update feature: add bulk update Mar 12, 2025
Copy link
Contributor

This PR has been marked as stale because there was no activity for the past 15 days.

if is_edit? && Avo.configuration.resource_default_view.show? # via resource show or edit page
return helpers.resource_path(record: @resource.record, resource: @resource, **keep_referrer_params)
end
return resource_show_path if returning_to_editable_show?
Copy link

Choose a reason for hiding this comment

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

Avoid too many return statements within this method.

@Nevelito
Copy link
Contributor Author

@Paul-Bob I’ve tested this task and it works correctly on the backend. Now we just need to take care of the frontend part. Do you have any suggestions ?

Copy link
Contributor

@Paul-Bob Paul-Bob left a comment

Choose a reason for hiding this comment

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

Hi @Nevelito,

Thanks for the great work! 🙌
I did some manual testing, and the controller already seem to be working as expected.
I'll perform a more detailed review of the controllers later.

In the meantime, I have a few questions about parts of the current implementation. Let's continue the discussion within the individual review comments.

Thanks again for your patience and collaboration!

Comment on lines +27 to +31
<% if @prefilled_fields.present? %>
<% @prefilled_fields.each do |field, value| %>
<%= hidden_field_tag "prefilled[#{field}]", value %>
<% end %>
<% end %>
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need this?

I imagined that each field would return the correct value when pre-filed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we use it to compare data, the case is that progress bar can not be null, it will automaticlly appear at 50%, so to avoid problems we have to double check if it was moved or delete it from the bulk update

Copy link
Contributor Author

Choose a reason for hiding this comment

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

btw during todays tasting I saw that tere is problems with stage in Projects model but it seems easy to solve, but I will solve it after weekend

@@ -71,13 +97,19 @@ def is_edit?
end

def form_method
return :put if is_edit?
return :put if is_edit? && params[:controller] != "avo/bulk_update"
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should use the put as well for bulk updates, any argument why we should use post?

Copy link
Contributor Author

@Nevelito Nevelito Apr 30, 2025

Choose a reason for hiding this comment

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

you can test it, when it is using put there are problems and records will not update. the case is that it have to update min. two records

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

Successfully merging this pull request may close these issues.

2 participants