Kerikim commited on
Commit
128f5d5
·
1 Parent(s): 99b7feb
Files changed (1) hide show
  1. utils/api.py +38 -0
utils/api.py CHANGED
@@ -397,3 +397,41 @@ def submit_practice_quiz(lesson: str, responses: dict):
397
 
398
  def send_to_chatbot(messages: list[dict]):
399
  return _json_or_raise(_req("POST", "/chatbot", json={"messages": messages}))
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
397
 
398
  def send_to_chatbot(messages: list[dict]):
399
  return _json_or_raise(_req("POST", "/chatbot", json={"messages": messages}))
400
+
401
+
402
+
403
+ #APIS-GAMES
404
+ def record_money_match_play(user_id:int, target:int, total:int, elapsed_ms:int, matched:bool, gained_xp:int):
405
+ return _req("POST", "/games/money_match/record", json={
406
+ "user_id": user_id,
407
+ "target": target,
408
+ "total": total,
409
+ "elapsed_ms": elapsed_ms,
410
+ "matched": matched,
411
+ "gained_xp": gained_xp,
412
+ }).json()
413
+
414
+ def record_budget_builder_play(user_id, weekly_allowance, allocations, total_allocated, remaining, gained_xp):
415
+ return _req("POST", "/games/budget_builder/record", json={
416
+ "user_id": user_id,
417
+ "weekly_allowance": weekly_allowance,
418
+ "allocations": allocations,
419
+ "total_allocated": total_allocated,
420
+ "remaining": remaining,
421
+ "gained_xp": gained_xp,
422
+ }).json()
423
+
424
+ def record_debt_dilemma_play(user_id, level, round_no, wallet, health, happiness, credit_score, event_json, outcome, gained_xp):
425
+ return _req("POST", "/games/debt_dilemma/record", json={
426
+ "user_id": user_id, "level": level, "round_no": round_no,
427
+ "wallet": wallet, "health": happiness, "happiness": happiness, "credit_score": credit_score,
428
+ "event_json": event_json, "outcome": outcome, "gained_xp": gained_xp,
429
+ }).json()
430
+
431
+ def record_profit_puzzle_play(user_id, scenario_id, title, units, price, cost, user_answer, actual_profit, is_correct, gained_xp):
432
+ return _req("POST", "/games/profit_puzzle/record", json={
433
+ "user_id": user_id, "scenario_id": scenario_id, "title": title,
434
+ "units": units, "price": price, "cost": cost,
435
+ "user_answer": user_answer, "actual_profit": actual_profit,
436
+ "is_correct": is_correct, "gained_xp": gained_xp,
437
+ }).json()