yuripeyamashita commited on
Commit
cac428c
·
verified ·
1 Parent(s): 2445a33

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -1
app.py CHANGED
@@ -43,11 +43,16 @@ def api():
43
  print(users)
44
 
45
  matrix = [[0 for _ in range(len(users))] for _ in range(len(users))]
46
- print(matrix)
47
 
48
  for msg_id, data in message_list.items():
49
  quoted_msg_id = data.get("quoted_msg_id")
50
  quoted_number = len([key for key, value in message_list.items() if value.get("quoted_msg_id") == msg_id])
 
 
 
 
 
 
51
  if not quoted_msg_id and quoted_number == 0: # 要平分的情況
52
  to = users.index(data.get("user_id"))
53
  for row in matrix:
 
43
  print(users)
44
 
45
  matrix = [[0 for _ in range(len(users))] for _ in range(len(users))]
 
46
 
47
  for msg_id, data in message_list.items():
48
  quoted_msg_id = data.get("quoted_msg_id")
49
  quoted_number = len([key for key, value in message_list.items() if value.get("quoted_msg_id") == msg_id])
50
+
51
+ if quoted_msg_id:
52
+ fr = users.index(data.get("user_id"))
53
+ to = users.index(quoted_msg_id)
54
+ matrix[fr][to] += data.get("amount")
55
+
56
  if not quoted_msg_id and quoted_number == 0: # 要平分的情況
57
  to = users.index(data.get("user_id"))
58
  for row in matrix: