Skip to content
This repository was archived by the owner on Sep 29, 2023. It is now read-only.

SYN-8435 Use correct commit param #12

Merged
merged 1 commit into from
Jun 29, 2021
Merged

Conversation

pamelalucinda
Copy link
Contributor

@pamelalucinda pamelalucinda commented Jun 28, 2021

https://repairtechsolutions.atlassian.net/browse/SYN-8435

Seems like the ImportWorker isn't getting triggered.. which makes sense, since the params[:commit] value when you click the green Process button is actually "Process Update"

Parameters: {"import"=>{"platform"=>"repairshopr", "subdomain"=>"demo", "api_key"=>"1c6b7ad4", "rows_to_process"=>"", "errors_to_allow"=>"", "match_on_asset_serial"=>"0", "staging_run"=>"0", "mapping"=>"MM/DD/YY", "data"=>"[FILTERED]"}, "commit"=>"Process Update", "id"=>"de23c084-c9d5-4225-9274-5aff75c7bb95"}

Copy link

@erikyuzwa erikyuzwa left a comment

Choose a reason for hiding this comment

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

wow - good find @pamelalucinda!

@pamelalucinda pamelalucinda merged commit e675250 into master Jun 29, 2021
ImportWorker.perform_async(@import.id) if params[:commit] == "Process"
ImportWorker.perform_async(@import.id) if params[:commit] == "Process Update"
Copy link
Contributor

Choose a reason for hiding this comment

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

So the intention behind this line and

<script>
$(function() {
$('.bhv-blur-save').blur(function() {
$(".bhv-submit").val("Process Update");
$(".bhv-submit").trigger('click.rails');
$(".bhv-submit").val("Process");
});
});
</script>
and
//now that we put it in the form, lets send an update so this persists..
$(".bhv-submit").val("Process Update");
$(".bhv-submit").trigger('click.rails');
$(".bhv-submit").val("Process");

Was to re-use the same web route to perform an Update with-running-worker and without-running-worker.

When editing platform, subdomain, api_key (in show.html.erb) and perhaps certain rows from import.js,
the Import record in the importr database would be updated with those values without running an ImportWorker. It tries to do this by modifying commit to Process Update and then back.

For some reason, the importr app is no longer changing Process Update back to Process. or more precisely: it looks to be changing Process => Process Update => Process => and then back to Process Update

a part that looks suspicious is using trigger("click.rails") which is a jquery-ujs thing when the app is using Rails 6. back in Rails 5, they replaced the default/standard jquery-ujs with rails-ujs. jquery-ujs seems to be supporting Rails 6, and working from production javascript console, but maybe there's a bug around that

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for this info, Steven! This is helpful.

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

Successfully merging this pull request may close these issues.

4 participants