Skip to content
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

fixed winner response getting #171

Merged
merged 1 commit into from
Mar 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions chat_client/static/js/message_utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,14 +116,15 @@ async function addPromptMessage(cid, userID, messageText, promptId, promptState)
const tableBody = document.getElementById(`${promptId}_tbody`);
if (await getCurrentSkin(cid) === CONVERSATION_SKINS.PROMPTS){
try {
const userData = await getUserData(userID);
promptState = PROMPT_STATES[promptState].toLowerCase();
if (!getUserPromptTR(promptId, userID)) {
const userData = await getUserData(userID);
const newUserRow = await buildSubmindHTML(promptId, userID, userData, '', '', '');
tableBody.insertAdjacentHTML('beforeend', newUserRow);
}
try {
const messageElem = document.getElementById(`${promptId}_${userID}_${promptState}`);
console.log("userData:", userData)
const messageElem = document.getElementById(`${promptId}_${userData['nickname']}_${promptState}`);
messageElem.innerText = messageText;
} catch (e) {
console.warn(`Failed to add prompt message (${cid},${userID}, ${messageText}, ${promptId}, ${promptState}) - ${e}`)
Expand Down
3 changes: 2 additions & 1 deletion chat_client/static/js/sio.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,9 @@ function initSIO(){
console.info(`setting prompt_id=${promptID} as completed`);
if (promptElem){
const promptWinner = document.getElementById(`${promptID}_winner`);
const winner_response = document.getElementById(`${promptID}_${data['winner']}_resp`).innerText;
console.log("data:", data)
promptWinner.innerHTML = await buildPromptWinnerHTML(data['winner']);
promptWinner.innerHTML = await buildPromptWinnerHTML(data['winner'], winner_response);
}else {
console.warn(`Failed to get HTML element from prompt_id=${promptID}`);
}
Expand Down
6 changes: 3 additions & 3 deletions chat_client/templates/components/prompt_participant.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@
{participant_icon}
</td>
<td>
<div style="overflow-y:auto; width:100%; max-height: 150px!important;" id="{prompt_id}_{user_id}_resp"
<div style="overflow-y:auto; width:100%; max-height: 150px!important;" id="{prompt_id}_{user_nickname}_resp"
data-message-id="{response_message_id}"
data-created-on="{response_created_on}"
data-toggle="tooltip"
title="{response_created_on_tooltip}">{response}
</div>
</td>
<td id="{prompt_id}_{user_id}_disc"
<td id="{prompt_id}_{user_nickname}_disc"
data-created-on="{opinion_created_on}"
data-message-id="{opinion_message_id}"
data-toggle="tooltip"
title="{opinion_created_on_tooltip}">{opinion}
</td>
<td id="{prompt_id}_{user_id}_vote"
<td id="{prompt_id}_{user_nickname}_vote"
data-created-on="{vote_created_on}"
data-message-id="{vote_message_id}"
data-toggle="tooltip"
Expand Down
1 change: 0 additions & 1 deletion chat_server/sio/handlers/prompt.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ async def prompt_completed(sid, data):
prompt_id = data["context"]["prompt"]["prompt_id"]

LOG.info(f"setting {prompt_id = } as completed")

MongoDocumentsAPI.PROMPTS.set_completed(
prompt_id=prompt_id, prompt_context=data["context"]
)
Expand Down