Pamudu13 commited on
Commit
631135b
Β·
verified Β·
1 Parent(s): 9960112

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +33 -10
app.py CHANGED
@@ -160,7 +160,7 @@ Please provide:
160
  except Exception as e:
161
  raise Exception(f"Error improving task description: {str(e)}")
162
 
163
- def create_trello_card(task_description, selected_members, location=None):
164
  """Create a Trello card with the improved task description"""
165
  try:
166
  boards = trello_client.list_boards()
@@ -180,16 +180,29 @@ def create_trello_card(task_description, selected_members, location=None):
180
  # Extract title and add timestamp
181
  timestamp = datetime.now().strftime("%Y-%m-%d %H:%M")
182
  title = task_description.split('\n')[0]
183
- formatted_title = f"[{timestamp}] {title}"
 
 
 
 
 
 
 
 
184
 
185
  location_text = "Remote/Virtual"
186
  location_coords = None
187
 
188
  if location:
189
  location_text = location
190
- # If you want to add coordinates, you could use a geocoding service here
191
- # Example: coordinates = geocode_location(location)
192
- # location_coords = f"{coordinates['lat']},{coordinates['lng']}"
 
 
 
 
 
193
 
194
  formatted_description = f"""🎯 TASK DETAILS
195
  ------------------------
@@ -199,7 +212,7 @@ def create_trello_card(task_description, selected_members, location=None):
199
  ------------------------
200
  πŸ•’ Created: {timestamp}
201
  🏷️ Source: TaskWhisper AI
202
- πŸ”„ Status: New
203
  πŸ“ Location: {location_text}
204
 
205
  βœ… CHECKLIST
@@ -222,11 +235,21 @@ Add your progress notes here...
222
  if location_coords:
223
  card.set_pos(location_coords)
224
 
225
- # Add a yellow label if available
226
  available_labels = board.get_labels()
227
- yellow_label = next((label for label in available_labels if label.color == 'yellow'), None)
228
- if yellow_label:
229
- card.add_label(yellow_label)
 
 
 
 
 
 
 
 
 
 
230
 
231
  # Assign members to card
232
  if selected_members:
 
160
  except Exception as e:
161
  raise Exception(f"Error improving task description: {str(e)}")
162
 
163
+ def create_trello_card(task_description, selected_members, location=None, urgency="normal"):
164
  """Create a Trello card with the improved task description"""
165
  try:
166
  boards = trello_client.list_boards()
 
180
  # Extract title and add timestamp
181
  timestamp = datetime.now().strftime("%Y-%m-%d %H:%M")
182
  title = task_description.split('\n')[0]
183
+
184
+ # Add urgency to title
185
+ urgency_markers = {
186
+ "normal": "πŸ“˜",
187
+ "high": "⚠️",
188
+ "urgent": "πŸ”΄"
189
+ }
190
+ urgency_marker = urgency_markers.get(urgency.lower(), "πŸ“˜")
191
+ formatted_title = f"[{timestamp}] {urgency_marker} {title}"
192
 
193
  location_text = "Remote/Virtual"
194
  location_coords = None
195
 
196
  if location:
197
  location_text = location
198
+
199
+ # Map urgency to status text
200
+ urgency_status = {
201
+ "normal": "Normal Priority",
202
+ "high": "High Priority",
203
+ "urgent": "URGENT"
204
+ }
205
+ status_text = urgency_status.get(urgency.lower(), "Normal Priority")
206
 
207
  formatted_description = f"""🎯 TASK DETAILS
208
  ------------------------
 
212
  ------------------------
213
  πŸ•’ Created: {timestamp}
214
  🏷️ Source: TaskWhisper AI
215
+ ⚑ Priority: {status_text}
216
  πŸ“ Location: {location_text}
217
 
218
  βœ… CHECKLIST
 
235
  if location_coords:
236
  card.set_pos(location_coords)
237
 
238
+ # Add label based on urgency
239
  available_labels = board.get_labels()
240
+ urgency_colors = {
241
+ "normal": "blue",
242
+ "high": "yellow",
243
+ "urgent": "red"
244
+ }
245
+ label_color = urgency_colors.get(urgency.lower(), "blue")
246
+
247
+ # Find and add the appropriate label
248
+ priority_label = next((label for label in available_labels if label.color == label_color), None)
249
+ if priority_label:
250
+ card.add_label(priority_label)
251
+ else:
252
+ print(f"Warning: {label_color} label not found on board")
253
 
254
  # Assign members to card
255
  if selected_members: