Skip to content

Commit e2f282a

Browse files
committed
fix: solve array render into draft
1 parent 39ad326 commit e2f282a

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

app/modules/ai_intelligence/controllers/draft_controller.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,12 @@ class DraftController < Api::V1::BaseController
99

1010
# POST /api/v1/ai/draft/analyze
1111
def analyze
12-
team_a = params.require(:team_a)
13-
team_b = params.require(:team_b)
12+
team_a = Array(params[:team_a]).reject(&:blank?)
13+
team_b = Array(params[:team_b]).reject(&:blank?)
1414
patch = params[:patch]
1515

16+
return render json: { error: 'team_a or team_b required' }, status: :bad_request if team_a.empty? && team_b.empty?
17+
1618
result = DraftAnalyzer.call(team_a: team_a, team_b: team_b, patch: patch)
1719

1820
if result.source == 'ml_v2'

0 commit comments

Comments
 (0)