visevol / GithubVisualisation

PFE028 Été 2024
MIT License
0 stars 1 forks source link

[Backend] Connect the `source_files` table with `source_file_changes` #33

Closed zergov closed 6 days ago

zergov commented 6 days ago

Closes: https://github.com/visevol/GihubVisualisation/issues/29

Connect the source_files table with source_file_changes. With this change, source_file_changes is now a join table between commits and source files.

Add new associations so expressions like these are possible:

repository = Repository.find_by(name: "rails")

initial_commit = repository.commits.first
initial_commit.source_files.count # number of files affected by the initial commit
=> 295

gemfile = repository.source_files.find_by(filepath: "Gemfile")
gemfile.commits.count # number of commits that modifies the Gemfile
=> 879