FIX: Filter classification type using the correct column (#286)
This commit is contained in:
parent
231cf91cc2
commit
458e66aef9
|
@ -36,7 +36,7 @@ module DiscourseAi
|
||||||
WHERE
|
WHERE
|
||||||
t.archetype = 'regular' AND
|
t.archetype = 'regular' AND
|
||||||
p.user_id > 0 AND
|
p.user_id > 0 AND
|
||||||
cr.classification_type = 'sentiment' AND
|
cr.model_used = 'sentiment' AND
|
||||||
(p.created_at > :report_start AND p.created_at < :report_end)
|
(p.created_at > :report_start AND p.created_at < :report_end)
|
||||||
GROUP BY DATE_TRUNC('day', p.created_at)
|
GROUP BY DATE_TRUNC('day', p.created_at)
|
||||||
SQL
|
SQL
|
||||||
|
@ -80,7 +80,7 @@ module DiscourseAi
|
||||||
WHERE
|
WHERE
|
||||||
t.archetype = 'regular' AND
|
t.archetype = 'regular' AND
|
||||||
p.user_id > 0 AND
|
p.user_id > 0 AND
|
||||||
cr.classification_type = 'emotion' AND
|
cr.model_used = 'emotion' AND
|
||||||
(p.created_at > :report_start AND p.created_at < :report_end)
|
(p.created_at > :report_start AND p.created_at < :report_end)
|
||||||
GROUP BY u.trust_level
|
GROUP BY u.trust_level
|
||||||
SQL
|
SQL
|
||||||
|
|
|
@ -1,13 +1,16 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
Fabricator(:classification_result) { target { Fabricate(:post) } }
|
Fabricator(:classification_result) do
|
||||||
|
target { Fabricate(:post) }
|
||||||
|
classification_type "sentiment"
|
||||||
|
end
|
||||||
|
|
||||||
Fabricator(:sentiment_classification, from: :classification_result) do
|
Fabricator(:sentiment_classification, from: :classification_result) do
|
||||||
classification_type "sentiment"
|
model_used "sentiment"
|
||||||
classification { { negative: 72, neutral: 23, positive: 4 } }
|
classification { { negative: 72, neutral: 23, positive: 4 } }
|
||||||
end
|
end
|
||||||
|
|
||||||
Fabricator(:emotion_classification, from: :classification_result) do
|
Fabricator(:emotion_classification, from: :classification_result) do
|
||||||
classification_type "emotion"
|
model_used "emotion"
|
||||||
classification { { negative: 72, neutral: 23, positive: 4 } }
|
classification { { negative: 72, neutral: 23, positive: 4 } }
|
||||||
end
|
end
|
||||||
|
|
|
@ -94,13 +94,13 @@ RSpec.describe DiscourseAi::Sentiment::EntryPoint do
|
||||||
let(:emotion_2) do
|
let(:emotion_2) do
|
||||||
{ sadness: 19, surprise: 63, neutral: 45, fear: 44, anger: 27, joy: 62, disgust: 30 }
|
{ sadness: 19, surprise: 63, neutral: 45, fear: 44, anger: 27, joy: 62, disgust: 30 }
|
||||||
end
|
end
|
||||||
let(:classification_type) { "emotion" }
|
let(:model_used) { "emotion" }
|
||||||
|
|
||||||
def emotion_classification(post, classification)
|
def emotion_classification(post, classification)
|
||||||
Fabricate(
|
Fabricate(
|
||||||
:sentiment_classification,
|
:sentiment_classification,
|
||||||
target: post,
|
target: post,
|
||||||
classification_type: classification_type,
|
model_used: model_used,
|
||||||
classification: classification,
|
classification: classification,
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue