(app)
| 249 | |
| 250 | @failsoft |
| 251 | def get_feed_data(app): |
| 252 | if not EVENTS_ENGINE: |
| 253 | return None |
| 254 | |
| 255 | params = { |
| 256 | "app": app, |
| 257 | } |
| 258 | |
| 259 | query = text(""" |
| 260 | select input_text, category, emoji, id |
| 261 | from featured_queries |
| 262 | where app = :app |
| 263 | and featured = true |
| 264 | """) |
| 265 | |
| 266 | with EVENTS_ENGINE.connect() as conn: |
| 267 | result = conn.execute(query, params) |
| 268 | conn.commit() |
| 269 | rows = result.fetchall() |
| 270 | |
| 271 | rows = [ |
| 272 | { |
| 273 | "input_text": row[0], |
| 274 | "category": row[1], |
| 275 | "emoji": row[2], |
| 276 | "img": "https://census-gpt-assets.s3.us-west-2.amazonaws.com/" + str(row[3]) + ".png", |
| 277 | } |
| 278 | for row in rows |
| 279 | ] |
| 280 | |
| 281 | return rows |
no outgoing calls
no test coverage detected