-
Notifications
You must be signed in to change notification settings - Fork 4
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
Add bulk complete UI #2550
Add bulk complete UI #2550
Conversation
closes #697 |
b26958a
to
8930700
Compare
8930700
to
0bed38d
Compare
0bed38d
to
3d5637c
Compare
3d5637c
to
0099255
Compare
0099255
to
0a7ad72
Compare
end | ||
|
||
def resources_update | ||
(_, document_list) = search_results(q: params["search_params"]["q"], f: params["search_params"]["f"]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this retrieve the whole set of results, or just the first page?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good question; we will look into this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd recommend adding a FL key with "id" too if that works through BL.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can't seem to provide fl
to the search builder.
logfile
Outdated
@@ -0,0 +1,2 @@ | |||
2019-02-11 10:48:40.115 EST [76779] FATAL: lock file "postmaster.pid" already exists | |||
2019-02-11 10:48:40.115 EST [76779] HINT: Is another postmaster (PID 501) running in data directory "/usr/local/var/postgres"? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like a stray logfile got added by mistake.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably that was mine
5adfe2b
to
738469e
Compare
c78c8c6
to
31299bf
Compare
c22d211
to
f352633
Compare
- Bulk edit button displays on search results page when a collection facet is selected. - search params are passed around so we can retrieve the same results set - Bulk edit controller queues 1 update job per 50 resources refs #697 still to do to close that ticket: - Add rights statement, rights note - Add search summary box to top of edit form Co-authored-by: christinach <actspatial@gmail.com>
Co-authored-by: Christina Chortaria <actspatial@gmail.com>
Co-authored-by: Anna Headley <anna.headley@gmail.com>
Wrap form in a panel Co-authored-by: Christina Chortaria <actspatial@gmail.com>
668b682
to
9b3a5b6
Compare
In manually testing this, I'm seeing some (but not all) of my objects get completed. For example, I bulk completed 76 objects in staging, and 22 were left pending. I created 150 pending objects in my local dev instance, and 65 were completed, and 85 were left pending. I can try this again, but I think it might make sense to take a look at the search logic to see if objects being completed are changing the search results as we page through them. |
@escowles i would totally believe that is happening. because it queues the batch update job and then queries solr for the next page. I think we can resolve this by creating all the jobs first, then queuing them. But I'm not sure how to write a regression test for a race condition like this. |
@HackMasterA Yes, I agree it would be very hard to test — I'd be fine with manually testing to make sure any updates behave as expected. |
12f0e58
to
3c5d6aa
Compare
@escowles I updated the way the jobs are queued. do you want to try it now? |
@HackMasterA Yep, I'll try it out now |
I'm still seeing only a portion of the records get updated. I've got my local environment setup to test this — do you want me to see if I can get it to complete them all? |
@escowles sure, thanks! |
@escowles are the resources more or less identical? or do they have different metadata, etc? |
I'm testing with identical resources (other than titles being "Resource #{n}". I think I've figured out why it's updating only the first page of resources (and have a fix). |
i will update the test / fix rubocop probably in the morning. |
ed16036
to
00d11ce
Compare
args = {}.tap do |hash| | ||
hash[:mark_complete] = (params["mark_complete"] == "1") | ||
end | ||
batches = prepare_batches |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you just rename prepare_batches
to batches
and memoize?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
app/jobs/bulk_update_job.rb
Outdated
# frozen_string_literal: true | ||
class BulkUpdateJob < ApplicationJob | ||
def perform(ids:, args:) | ||
return unless args[:mark_complete] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why would this ever get queued without mark_complete? I mean, I guess it would right now, but wouldn't it be more efficient to just not queue a thing if it didn't need updated?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this was a sort of breadcrumb for the fact that we will add new options to the form as we go along. but it doesn't really make sense the way it is; I'll look at moving or removing it.
@tpendragon I answered some of these questions and made some changes. memoizing batches increased its ABC so I had to extract another method. take another look? let me know what you think. |
attributes = {}.tap do |attrs| | ||
attrs[:state] = "complete" if args[:mark_complete] && !resource.state.include?("complete") | ||
end | ||
change_set.validate(attributes) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we check the value of this so it doesn't update it if there's a validation error? Maybe even have it throw an exception so this batch dies?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tpendragon I just added this please take a look. Thanks!
attrs[:state] = "complete" if args[:mark_complete] && !resource.state.include?("complete") | ||
end | ||
change_set.validate(attributes) | ||
if change_set.changed? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is going to do what you want. Should be if change_set.validate(attributes)
or if change_set.valid?
.
change_set.changed?
will just tell you if a property is different, which it really should be if it's being bulk updated.
I'm actually a little concerned the tests below pass in light of this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OH, I see what's going on. Ignore me.
is selected.
set
Closes #1860
Closes #2494
Closes #697
Other functionality moved to #2586