DB Match Predictors schema
This document presents the organization of Match Predictor functionality in the database along with a description of the relationships between tables.
DB schema
classDiagram
Match <-- `MatchPredictors::MatchPrediction`
Match <-- `MatchPredictors::UserAnswer`
User <-- `MatchPredictors::UserAnswer`
User <-- `MatchPredictors::UserResult`
`MatchPredictors::Ranking` <-- `MatchPredictors::UserResult`
`MatchPredictors::MatchPrediction` : match_id
`MatchPredictors::MatchPrediction` : home
`MatchPredictors::MatchPrediction` : away
`MatchPredictors::MatchPrediction` : draw
`MatchPredictors::UserAnswer` : user_id
`MatchPredictors::UserAnswer` : match_id
`MatchPredictors::UserResult` : user_id
`MatchPredictors::UserResult` : ranking_id
`MatchPredictors::UserResult` : points
`MatchPredictors::UserResult` : form
`MatchPredictors::Ranking` : resource_id
`MatchPredictors::Ranking` : resource_type
`MatchPredictors::Ranking` : name
`MatchPredictors::Ranking` : date_from
`MatchPredictors::Ranking` : date_to
Schema description
MatchPredictors::MatchPrediction
belongs_to: match
MatchPredictors::Ranking
belongs_to :resource, polymorphic: true
has_many :match_predictor_user_results
has_many :match_predictor_ranking_components
end
MatchPredictors::UserResult
belongs_to :user
belongs_to :match_predictor_ranking
end
MatchPredictors::UserAnswer
belongs_to :user
belongs_to :match
end