1
0
Fork 0

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.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
if time_n_value.to_i > 0 && time_unit.present?
topics.select! { |t| t.created_at >= time_n_value.to_i.send(time_unit).ago }
end
end
topics.map! { |t| SimilarTopic.new(t) }
result.items = topics