Skip to content

Added minute to the to match and updating it in the API#146

Merged
dmbf29 merged 1 commit into
mainfrom
auto-results
Jun 7, 2026
Merged

Added minute to the to match and updating it in the API#146
dmbf29 merged 1 commit into
mainfrom
auto-results

Conversation

@dmbf29

@dmbf29 dmbf29 commented Jun 7, 2026

Copy link
Copy Markdown
Owner

No description provided.

@dmbf29 dmbf29 requested review from caiosantosss and Copilot June 7, 2026 06:46
@dmbf29 dmbf29 self-assigned this Jun 7, 2026
@dmbf29 dmbf29 added the enhancement New feature or request label Jun 7, 2026

@caiosantosss caiosantosss left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. that's crazy if this can work.

@dmbf29 dmbf29 merged commit b3bf656 into main Jun 7, 2026
1 check passed
@dmbf29 dmbf29 deleted the auto-results branch June 7, 2026 06:49

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a minute field to Match records, exposes it through the v1 matches API response, and introduces scheduled background updates intended to keep match timing data current during live matches.

Changes:

  • Add minute: integer to matches (migration + schema update).
  • Include minute in the v1 match JSON payload.
  • Schedule frequent match update jobs around kickoff time and set minute from the upstream API.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
lib/tasks/match.rake Extends fake-results task to set minute for “started” matches and adjusts which matches are modified.
db/schema.rb Reflects the new minute column on matches.
db/migrate/20260607063338_add_minute_to_matches.rb Adds the minute column to matches.
app/views/v1/matches/_match.json.jbuilder Exposes minute in the match JSON representation.
app/jobs/schedule_daily_tasks_job.rb Schedules periodic match update jobs during match windows.
app/jobs/match_update_job.rb Persists minute from the upstream API when updating matches.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +11 to +14
# Calls the API during the matches to get the current time
150.times do |i|
MatchUpdateJob.set(wait_until: kickoff_time + i.minutes).perform_later(competition.id)
end
Comment on lines 33 to 40
match.round = Round.find_by(competition: @competition, api_name: match_info['stage'])
match.group = Group.find_by(round: match.round, api_code: match_info["group"]) if match_info["group"]
match.api_id = match_info['id']
match.location = match_info['venue']
match.minute = match_info['minute']
match.kickoff_time = kickoff_time
match.save
p match.errors.full_messages if match.errors.any?
Comment thread lib/tasks/match.rake
Comment on lines 6 to +8
@competition = Competition.last
completed_matches = @competition.matches.order(kickoff_time: :asc).first(5)
completed_matches.each do |match|
completed_matches = @competition.matches.order(kickoff_time: :asc).first(7)
completed_matches.each_with_index do |match, index|
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants