-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This adds a new column to sessions for capturing the academic year of the session, which will eventually form part of a unique index between the academic year, team and location. The immunisation import has also been changed to create sessions for the academic year, and attach multiple dates to it. After this, the next step is to update the sessions pages in the service to display the information as in the prototype.
- Loading branch information
1 parent
242e942
commit 3a598ae
Showing
8 changed files
with
48 additions
and
17 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
20 changes: 20 additions & 0 deletions
20
db/migrate/20240925132918_add_academic_year_to_sessions.rb
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# frozen_string_literal: true | ||
|
||
class AddAcademicYearToSessions < ActiveRecord::Migration[7.2] | ||
def up | ||
add_column :sessions, :academic_year, :integer | ||
|
||
Session.all.find_each do |session| | ||
session.update!( | ||
academic_year: | ||
(session.dates.map(&:value).min || Date.current).academic_year | ||
) | ||
end | ||
|
||
change_column_null :sessions, :academic_year, false | ||
end | ||
|
||
def down | ||
remove_column :sessions, :academic_year | ||
end | ||
end |
This file contains 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
This file contains 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
This file contains 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