markobinario commited on
Commit
467ee1c
·
verified ·
1 Parent(s): 428cbc4

Update database_connection.py

Browse files
Files changed (1) hide show
  1. database_connection.py +4 -4
database_connection.py CHANGED
@@ -32,14 +32,14 @@ class DatabaseConnection:
32
  return pd.DataFrame()
33
 
34
  def add_feedback(self, course: str, stanine: int, gwa: float, strand: str,
35
- rating: str, hobbies: str) -> bool:
36
  """Add new feedback to the database"""
37
  try:
38
  # Try the original structure first (matching the existing data)
39
  url = f"{self.base_url}/student_feedback_counts"
40
 
41
- # Rating is already a string ("like" or "dislike")
42
- rating_str = rating
43
 
44
  data = {
45
  "course": course,
@@ -59,7 +59,7 @@ class DatabaseConnection:
59
  # If the above fails, try the API structure you provided
60
  try:
61
  print("Trying alternative API structure...")
62
- feedback_type = rating # Rating is already "like" or "dislike"
63
 
64
  import hashlib
65
  student_data = f"{stanine}_{gwa}_{strand}_{hobbies}"
 
32
  return pd.DataFrame()
33
 
34
  def add_feedback(self, course: str, stanine: int, gwa: float, strand: str,
35
+ rating: int, hobbies: str) -> bool:
36
  """Add new feedback to the database"""
37
  try:
38
  # Try the original structure first (matching the existing data)
39
  url = f"{self.base_url}/student_feedback_counts"
40
 
41
+ # Convert integer rating to string format for database
42
+ rating_str = "like" if rating == 1 else "dislike"
43
 
44
  data = {
45
  "course": course,
 
59
  # If the above fails, try the API structure you provided
60
  try:
61
  print("Trying alternative API structure...")
62
+ feedback_type = "like" if rating == 1 else "dislike"
63
 
64
  import hashlib
65
  student_data = f"{stanine}_{gwa}_{strand}_{hobbies}"