Added minute to the to match and updating it in the API#146
Merged
Conversation
caiosantosss
approved these changes
Jun 7, 2026
caiosantosss
left a comment
Collaborator
There was a problem hiding this comment.
LGTM. that's crazy if this can work.
Contributor
There was a problem hiding this comment.
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: integertomatches(migration + schema update). - Include
minutein the v1 match JSON payload. - Schedule frequent match update jobs around kickoff time and set
minutefrom 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 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| |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.