-
Notifications
You must be signed in to change notification settings - Fork 72
Adds #172 - Option to touch localizations #173
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
Conversation
end | ||
|
||
def localization_for(locale, localization_key) | ||
@_localization_for ||= {} | ||
key = [locale, localization_key] | ||
ret = @_localization_for[key] | ||
binding.pry if localization_key == 'scopes.string' |
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.
Remove before merging
if ret == false | ||
nil | ||
elsif ret.nil? | ||
ret = grouped_localizations[localization_key][locale] | ||
unless ret | ||
::Rails.logger.info "******** REFRESHING the key" |
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.
Is it part of previous PR when you tried to reproduce ret
being false or is it relevant for this PR?
<td> | ||
<% if localization %> | ||
<%= draw_icon 'clock-o', title: "Last updated at #{localization.updated_at.to_s(:db)}" %> | ||
<%= link_to lit.previous_versions_localization_key_localization_path(lk, localization, format: :js), class: "show_prev_versions #{'hidden' unless versions?(localization)}", remote: true do %> |
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.
show_prev_versions
-> js-show-prev-versions
as it's not used for styling, just for targeting via jquery in one of js.erb actions
v.update_column :updated_at, 1.day.ago | ||
a.update_column :updated_at, 1.day.ago | ||
post :batch_touch, params: { key: 'value' }, format: :js | ||
assert v.reload.updated_at > 1.second.ago |
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've found asserting two time values to be much more reliable by using this assertion:
assert_in_delta(v.reload.updated_at, 1.second.ago, 5)
where 5 means 5 seconds (delta).
Otherwise we may face flaky test failures in the future. You can assign some constant to 5 or leave the magic number, it's not that important in tests :)
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.
Also this syntax would allow you to use 1.day.ago
instead of 23.hours.ago
to be more clear that we are asserting that a.updated_at
did not change
Adds options to allow "touching" localizations in batch - this is useful for situations with synchronizations. All "touched" localizations will be for sure subject of next synchronization.


