0
0
Fork 1
Spiegel von https://github.com/paviliondev/discourse-custom-wizard.git synchronisiert 2024-11-22 09:20:29 +01:00

simplified the conditional

Dieser Commit ist enthalten in:
Faizaan Gagan 2021-02-26 09:46:23 +05:30
Ursprung 6754d744f0
Commit 33e457a5c9

Datei anzeigen

@ -33,11 +33,9 @@ class CustomWizard::RealtimeValidation::SimilarTopics
topics = Topic.similar_to(title, raw, user).to_a topics = Topic.similar_to(title, raw, user).to_a
topics.select! { |t| categories.include?(t.category.id.to_s) } if categories.present? topics.select! { |t| categories.include?(t.category.id.to_s) } if categories.present?
if time_n_value.present? and time_unit.present? if time_n_value.to_i > 0 && 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 } topics.select! { |t| t.created_at >= time_n_value.to_i.send(time_unit).ago }
end end
end
topics.map! { |t| SimilarTopic.new(t) } topics.map! { |t| SimilarTopic.new(t) }
result.items = topics result.items = topics