Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(scheduler): use correct metadata indexing #5245

Merged
merged 1 commit into from
Sep 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 1 addition & 9 deletions src/dispatch/plugins/dispatch_slack/feedback/interactive.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ def handle_oncall_shift_feedback_submission_event(
feedback = form_data.get(ServiceFeedbackNotificationBlockIds.feedback_input, "")
rating = form_data.get(ServiceFeedbackNotificationBlockIds.rating_select, {}).get("value")

# metadata is organization_slug|project_id|schedule_id|shift_end_at|reminder_id|shift_start_at|details
# metadata is organization_slug|project_id|schedule_id|shift_end_at|reminder_id|details
metadata = body["view"]["private_metadata"].split("|")
project_id = metadata[1]
schedule_id = metadata[2]
Expand All @@ -403,16 +403,9 @@ def handle_oncall_shift_feedback_submission_event(
if reminder_id.isnumeric():
reminder_service.delete(db_session=db_session, reminder_id=reminder_id)
if len(metadata) > 5:
shift_start_raw = metadata[5]
shift_start_at = (
datetime.strptime(shift_start_raw, "%Y-%m-%dT%H:%M:%SZ")
if "T" in shift_start_raw
else datetime.strptime(shift_start_raw, "%Y-%m-%d %H:%M:%S")
)
# if there are other details, store those
details = json.loads(metadata[5])
else:
shift_start_at = None
details = None

individual = (
Expand All @@ -432,7 +425,6 @@ def handle_oncall_shift_feedback_submission_event(
rating=ServiceFeedbackRating(rating),
schedule=schedule_id,
shift_end_at=shift_end_at,
shift_start_at=shift_start_at,
project=project,
details=details,
)
Expand Down
Loading