Spaces:
Sleeping
Sleeping
fix return
Browse files
app.py
CHANGED
|
@@ -72,8 +72,14 @@ def get_employee_job_title(first_name:str, last_name:str)-> str: #it's import to
|
|
| 72 |
conn = sqlite3.connect('employee_database.db')
|
| 73 |
cursor = conn.cursor()
|
| 74 |
|
| 75 |
-
|
| 76 |
-
rows
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 77 |
|
| 78 |
final_answer = FinalAnswerTool()
|
| 79 |
|
|
|
|
| 72 |
conn = sqlite3.connect('employee_database.db')
|
| 73 |
cursor = conn.cursor()
|
| 74 |
|
| 75 |
+
cursor.execute(f"SELECT job_title FROM employees WHERE first_name='{first_name}' AND last_name='{last_name}'")
|
| 76 |
+
if len(rows) > 1:
|
| 77 |
+
return "Many employees with that name"
|
| 78 |
+
elif len(rows) == 0:
|
| 79 |
+
return "No employee with that name"
|
| 80 |
+
else:
|
| 81 |
+
row = cursor.fetchall()[0][0]
|
| 82 |
+
return row
|
| 83 |
|
| 84 |
final_answer = FinalAnswerTool()
|
| 85 |
|