CognitiveScience commited on
Commit
b72bc42
1 Parent(s): 9f7aed6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -4
app.py CHANGED
@@ -44,7 +44,7 @@ except sqlite3.OperationalError:
44
  '''
45
  CREATE TABLE reviews (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
46
  created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
47
- name TEXT, rate INTEGER, celsci_Result TEXT)
48
  ''')
49
  db.commit()
50
  db.close()
@@ -52,16 +52,16 @@ except sqlite3.OperationalError:
52
  def get_latest_reviews(db: sqlite3.Connection):
53
  reviews = db.execute("SELECT * FROM reviews ORDER BY id DESC limit 100").fetchall()
54
  total_reviews = db.execute("Select COUNT(id) from reviews").fetchone()[0]
55
- reviews = pd.DataFrame(reviews, columns=["id", "date_created", "name", "rate", "celsci_Result"])
56
  return reviews, total_reviews
57
 
58
 
59
- def ccogsphere(name: str, rate: int, celsci_Result: str):
60
  db = sqlite3.connect(DB_FILE)
61
  cursor = db.cursor()
62
  reviews, total_reviews = get_latest_reviews(db)
63
  reviews = db.execute("SELECT * FROM reviews ORDER BY id DESC limit 100").fetchall()
64
- reviews = pd.DataFrame(reviews, columns=["id", "date_created", "name", "rate", "celsci_Result"])
65
  db.commit()
66
  reviews, total_reviews = get_latest_reviews(db)
67
  db.close()
@@ -84,6 +84,15 @@ def run_actr():
84
  env.model1.choice=env.choice1
85
  env.model2=ProceduralPlayer()
86
  env.model2.choice=env.choice2
 
 
 
 
 
 
 
 
 
87
  env.run()
88
 
89
 
 
44
  '''
45
  CREATE TABLE reviews (id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
46
  created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
47
+ name TEXT, rate INTEGER, celsci TEXT)
48
  ''')
49
  db.commit()
50
  db.close()
 
52
  def get_latest_reviews(db: sqlite3.Connection):
53
  reviews = db.execute("SELECT * FROM reviews ORDER BY id DESC limit 100").fetchall()
54
  total_reviews = db.execute("Select COUNT(id) from reviews").fetchone()[0]
55
+ reviews = pd.DataFrame(reviews, columns=["id", "date_created", "name", "rate", "celsci"])
56
  return reviews, total_reviews
57
 
58
 
59
+ def ccogsphere(name: str, rate: int, celsci: str):
60
  db = sqlite3.connect(DB_FILE)
61
  cursor = db.cursor()
62
  reviews, total_reviews = get_latest_reviews(db)
63
  reviews = db.execute("SELECT * FROM reviews ORDER BY id DESC limit 100").fetchall()
64
+ reviews = pd.DataFrame(reviews, columns=["id", "date_created", "name", "rate", "celsci"])
65
  db.commit()
66
  reviews, total_reviews = get_latest_reviews(db)
67
  db.close()
 
84
  env.model1.choice=env.choice1
85
  env.model2=ProceduralPlayer()
86
  env.model2.choice=env.choice2
87
+
88
+ db = sqlite3.connect(DB_FILE)
89
+ cursor = db.cursor()
90
+ cursor.execute("INSERT INTO reviews(name, rate, celsci) VALUES(?,?,?)", ["name", 0, "celsci"])
91
+ db.commit()
92
+ reviews, total_reviews = get_latest_reviews(db)
93
+ db.close()
94
+ #demo.load()
95
+ return reviews, total_reviews
96
  env.run()
97
 
98