rename n_value to time_n_value
Dieser Commit ist enthalten in:
Ursprung
c54273b94a
Commit
bc2cc85804
4 geänderte Dateien mit 7 neuen und 7 gelöschten Zeilen
|
@ -25,7 +25,7 @@
|
|||
<label>{{i18n 'admin.wizard.field.validations.time_after'}}</label>
|
||||
</div>
|
||||
<div class="setting-value">
|
||||
{{input type="number" class="time-n-value" value=props.n_value}}
|
||||
{{input type="number" class="time-n-value" value=props.time_n_value}}
|
||||
{{combo-box
|
||||
value=(readonly props.time_unit)
|
||||
content=timeUnits
|
||||
|
|
|
@ -125,7 +125,7 @@ export default WizardFieldValidator.extend({
|
|||
title: this.get("field.value"),
|
||||
categories: this.get("validation.categories"),
|
||||
time_unit: this.get("validation.time_unit"),
|
||||
n_value: this.get("validation.n_value")
|
||||
time_n_value: this.get("validation.time_n_value")
|
||||
}).then((result) => {
|
||||
const similarTopics = A(
|
||||
deepMerge(result["topics"], result["similar_topics"])
|
||||
|
|
|
@ -21,7 +21,7 @@ class CustomWizard::RealtimeValidation::SimilarTopics
|
|||
title = params[:title]
|
||||
raw = params[:raw]
|
||||
categories = params[:categories]
|
||||
n_value = params[:n_value]
|
||||
time_n_value = params[:time_n_value]
|
||||
time_unit = params[:time_unit]
|
||||
|
||||
result = CustomWizard::RealtimeValidation::Result.new(:similar_topic)
|
||||
|
@ -33,9 +33,9 @@ class CustomWizard::RealtimeValidation::SimilarTopics
|
|||
topics = Topic.similar_to(title, raw, user).to_a
|
||||
topics.select! { |t| categories.include?(t.category.id.to_s) } if categories.present?
|
||||
|
||||
if n_value.present? and time_unit.present?
|
||||
if n_value.to_i > 0
|
||||
topics.select! { |t| t.created_at >= n_value.to_i.send(time_unit).ago }
|
||||
if time_n_value.present? and time_unit.present?
|
||||
if time_n_value.to_i > 0
|
||||
topics.select! { |t| t.created_at >= time_n_value.to_i.send(time_unit).ago }
|
||||
end
|
||||
end
|
||||
topics.map! { |t| SimilarTopic.new(t) }
|
||||
|
|
|
@ -35,7 +35,7 @@ describe ::CustomWizard::RealtimeValidation::SimilarTopics do
|
|||
cat_topic.update!(created_at: 2.days.ago)
|
||||
|
||||
validation = ::CustomWizard::RealtimeValidation::SimilarTopics.new(user)
|
||||
result = validation.perform({ title: "matching similar", n_value: 1, time_unit: "days" })
|
||||
result = validation.perform({ title: "matching similar", time_n_value: 1, time_unit: "days" })
|
||||
expect(result.items.length).to eq(1)
|
||||
end
|
||||
end
|
||||
|
|
Laden …
In neuem Issue referenzieren