Skip to content

Commit

Permalink
fix similarity number matching
Browse files Browse the repository at this point in the history
  • Loading branch information
Danieldu committed Sep 19, 2023
1 parent 5733292 commit 2de8f85
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 17 deletions.
18 changes: 7 additions & 11 deletions component/screen.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,14 @@ def saveResult(self,history):
user_df = csvHandler.get_user()
user_df = user_df.drop(user_df.index)

result = pd.DataFrame([element.to_dict() for element in history])
result['participate_number'] = csvHandler.get_new_sessionId()
new_history_value = pd.DataFrame([element.to_dict() for element in history])
new_history_value['participate_number'] = csvHandler.get_new_sessionId()
user_df = user_df.append({"participantID":csvHandler.get_new_sessionId()}, ignore_index=True)
print(user_df)
print(result)
print(new_history_value)


csvHandler.append_history_data(result)
csvHandler.append_history_data(new_history_value)
csvHandler.append_user_data(user_df)


Expand Down Expand Up @@ -168,8 +168,6 @@ def updateProcess(self):

# Action for BofoMo consonants
def bofomo_consonant_action(self, button_index):
# This function is called when a BofoMo consonant button is clicked.
# 'button_index' is the index of the button that was clicked.
selected_consonant = pofomopo_consonants[button_index]
current_question = self.answerList[self.current_index]
current_question.set_answer(button_index)
Expand All @@ -179,11 +177,9 @@ def bofomo_consonant_action(self, button_index):

# Action for similarities
def similarity_action(self, button_index):
# This function is called when a similarity button is clicked.
# 'button_index' is the index of the button that was clicked.
selected_similarity = similarity_list[button_index]
print("selected_similarity:",selected_similarity)
current_question = self.answerList[self.current_index]
current_question.set_similarity(button_index)
print(f"Similarity button clicked: {selected_similarity}")
self.similarities_list.updateState(current_question.get_similarity())
current_question.set_similarity(selected_similarity)
self.similarities_list.updateState(button_index)
return self
6 changes: 0 additions & 6 deletions error.log

This file was deleted.

40 changes: 40 additions & 0 deletions static/csv/history.csv
Original file line number Diff line number Diff line change
@@ -1 +1,41 @@
question,particiapnts_no,participants_ans,participants_evaluation
2,2,2,1
0,14,3,1
3,-1,-1,1
7,-1,-1,1
5,-1,-1,1
1,-1,-1,1
4,-1,-1,1
6,-1,-1,1
6,3,2,2
2,-1,-1,2
7,-1,-1,2
5,-1,-1,2
3,-1,-1,2
1,-1,-1,2
0,-1,-1,2
4,-1,-1,2
4,2,3,3
2,-1,-1,3
1,-1,-1,3
7,-1,-1,3
5,-1,-1,3
0,-1,-1,3
6,-1,-1,3
3,-1,-1,3
6,3,3,4
7,-1,-1,4
4,-1,-1,4
3,-1,-1,4
5,-1,-1,4
2,-1,-1,4
1,-1,-1,4
0,-1,-1,4
4,3,4,5
1,-1,-1,5
3,-1,-1,5
5,-1,-1,5
2,-1,-1,5
7,-1,-1,5
0,-1,-1,5
6,-1,-1,5
5 changes: 5 additions & 0 deletions static/csv/user.csv
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
participantID

1
2
3
4
5

0 comments on commit 2de8f85

Please sign in to comment.