Repository navigation
Added migration sync logic for 1MV Feedback Bot #39
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
Open
arshad-47
wants to merge
2
commits into
ELEVATE-Project:release-1.4.0
Choose a base branch
from
arshad-47:release-2.1
base: release-1.4.0
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| SELECT DISTINCT | ||
| cs.id::text AS submission_id | ||
| FROM chatbot_chatsession cs | ||
| LEFT JOIN chatbot_profile cp ON cs.profile_id = cp.id | ||
| WHERE cs.session_type = ANY(%(session_types)s::text[]) | ||
| AND (cp.source IS NULL OR cp.source <> ALL(%(excluded_sources)s::text[])); | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| SELECT | ||
| cs.company_bot_id AS bot_id, | ||
| cb.name AS bot_name, | ||
| cs.session_type, | ||
| cs.session_status AS session_status, | ||
| cs.session, | ||
| cs.id AS submission_id, | ||
| cs.language, | ||
| ROW_NUMBER() OVER ( | ||
| PARTITION BY cc.session | ||
| ORDER BY cc.created_at, cc.id | ||
| ) + 1 AS sequence, | ||
| cc.id AS conversation_row_id, | ||
| cc.message, | ||
| cc.translated_message, | ||
| cc.created_at, | ||
| cc.updated_at, | ||
| cc.stage, | ||
| cc.receiver_id, | ||
| cc.sender_id, | ||
| cc.audio_file, | ||
| cc.file_url, | ||
| cc.other_params | ||
| FROM chatbot_companychat cc | ||
| JOIN chatbot_chatsession cs ON cc.session = cs.session | ||
| JOIN chatbot_companybot cb ON cb.id = cs.company_bot_id | ||
| WHERE cs.session_type = ANY(%(session_types)s::text[]) | ||
| AND (cardinality(%(submission_ids)s::bigint[]) = 0 OR cs.id = ANY(%(submission_ids)s::bigint[])) | ||
|
|
||
| UNION ALL | ||
|
|
||
| SELECT | ||
| cs.company_bot_id, | ||
| cb.name, | ||
| cs.session_type, | ||
| cs.session_status, | ||
| cs.session, | ||
| cs.id, | ||
| cs.language, | ||
| 1 AS sequence, | ||
| NULL::bigint, | ||
| intro.msg_en, | ||
| intro.msg_trans, | ||
| NULL::timestamptz, | ||
| NULL::timestamptz, | ||
| NULL::text, | ||
| NULL::bigint, | ||
| NULL::bigint, | ||
| NULL::text, | ||
| NULL::text, | ||
| NULL::jsonb | ||
| FROM chatbot_chatsession cs | ||
| JOIN chatbot_companybot cb ON cb.id = cs.company_bot_id | ||
| JOIN LATERAL ( | ||
| SELECT MIN(created_at) AS first_at | ||
| FROM chatbot_companychat | ||
| WHERE session = cs.session | ||
| ) s ON s.first_at IS NOT NULL | ||
|
coderabbitai[bot] marked this conversation as resolved.
Resolved
|
||
| JOIN LATERAL ( | ||
| SELECT | ||
| (SELECT COALESCE(NULLIF(h.alt_introductory_message, ''), h.introductory_message) | ||
| FROM chatbot_historicalbotvernacular h | ||
| WHERE h.company_bot_id = cs.company_bot_id AND h.language = 'en' | ||
| AND h.history_type <> '-' AND h.history_date <= s.first_at | ||
| ORDER BY h.history_date DESC, h.history_id DESC LIMIT 1) AS msg_en, | ||
| (SELECT COALESCE(NULLIF(h.alt_introductory_message, ''), h.introductory_message) | ||
| FROM chatbot_historicalbotvernacular h | ||
| WHERE h.company_bot_id = cs.company_bot_id AND h.language = cs.language | ||
| AND h.history_type <> '-' AND h.history_date <= s.first_at | ||
| ORDER BY h.history_date DESC, h.history_id DESC LIMIT 1) AS msg_trans | ||
| ) intro ON (intro.msg_en IS NOT NULL OR intro.msg_trans IS NOT NULL) | ||
| WHERE cs.session_type = ANY(%(session_types)s::text[]) | ||
| AND (cardinality(%(submission_ids)s::bigint[]) = 0 OR cs.id = ANY(%(submission_ids)s::bigint[])) | ||
| ORDER BY bot_id, session, sequence; | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.