Skip to content

Commit

Permalink
fix(fworks): frameworks lot field now saves correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
ryantk committed Sep 19, 2023
1 parent 3a40716 commit a69f525
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 5 deletions.
2 changes: 2 additions & 0 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ Rails/BulkChangeTable:
- 'db/migrate/20220805130609_change_support_emails_in_reply_to_id.rb'
- 'db/migrate/20221014140003_add_more_trust_fields_to_support_organisations.rb'
- 'db/migrate/20230210133230_refactor_notifications_into_one_table.rb'
- 'db/migrate/20230919092926_update_lot_frameworks_framework.rb'

# Offense count: 2
# Configuration parameters: Include.
Expand All @@ -94,6 +95,7 @@ Rails/ReversibleMigration:
- 'db/migrate/20201112123028_remove_answer_table.rb'
- 'db/migrate/20210118110545_change_options_to_jsonb.rb'
- 'db/migrate/20210125171840_remove_next_entry_id.rb'
- 'db/migrate/20230919092926_update_lot_frameworks_framework.rb'

# Offense count: 1
# This cop supports unsafe autocorrection (--autocorrect-all).
Expand Down
6 changes: 3 additions & 3 deletions app/views/frameworks/frameworks/_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
<%= f.govuk_fieldset legend: { text: 'Availability' } do %>
<div class="govuk-grid-row">
<div class="govuk-grid-column-one-half" id="dfe-start-date">
<%= f.govuk_date_field :dfe_start_date, legend: { size: "s", text: "DfE start date", class: "" } %>
<%= f.govuk_date_field :dfe_start_date, legend: { size: "s", text: "DfE start date" } %>
</div>
<div class="govuk-grid-column-one-half" id="dfe-end-date">
<%= f.govuk_date_field :dfe_end_date, legend: { size: "s", text: "DfE end date", class: "" } %>
<%= f.govuk_date_field :dfe_end_date, legend: { size: "s", text: "DfE end date" } %>
</div>
</div>
<div class="govuk-grid-row">
Expand All @@ -40,7 +40,7 @@
<% dps_options = [[true, 'Yes'], [false, 'No']] %>
<%= f.govuk_collection_radio_buttons :dps, dps_options, :first, :last, inline: true, legend: { size: 's', text: 'Is this framework a DPS (Dynamic purchasing system)?' } %>

<% lot_options = [['single', 'Single-lot'], ['multi', 'Multi-lot']] %>
<% lot_options = Frameworks::Framework.lots.map {|status, id| [status, status.humanize + "-lot"] } %>
<%= f.govuk_collection_radio_buttons :lot, lot_options, :first, :last, inline: true, legend: { size: 's', text: 'Is this framework a single or multi lot?' } %>

<% status_options = Frameworks::Framework.statuses.map {|status, id| [status, status.humanize] } %>
Expand Down
10 changes: 10 additions & 0 deletions app/views/frameworks/frameworks/show/_framework_details.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,16 @@
<dd class="govuk-summary-list__actions"><%= link_to "Change", edit_frameworks_framework_categorisations_path(@framework, back_to: current_url_b64(:framework_details)), class: "govuk-link", "data-turbo" => false %></dd>
</div>

<div class="govuk-summary-list__row">
<dt class="govuk-summary-list__key">Single / Multi-lot</dt>
<dd class="govuk-summary-list__value"><%= @framework.lot.humanize %></dd>
</div>

<div class="govuk-summary-list__row">
<dt class="govuk-summary-list__key">DPS?</dt>
<dd class="govuk-summary-list__value"><%= @framework.dps? ? "Yes" : "No" %></dd>
</div>

<div class="govuk-summary-list__row">
<dt class="govuk-summary-list__key">SCT Framework Owner</dt>
<dd class="govuk-summary-list__value"><%= @framework.sct_framework_owner %></dd>
Expand Down
6 changes: 6 additions & 0 deletions db/migrate/20230919092926_update_lot_frameworks_framework.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
class UpdateLotFrameworksFramework < ActiveRecord::Migration[7.0]
def change
change_column_default :frameworks_frameworks, :lot, from: 0, to: nil
change_column :frameworks_frameworks, :lot, :integer, using: "lot::integer", default: 0
end
end
4 changes: 2 additions & 2 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema[7.0].define(version: 2023_09_15_110928) do
ActiveRecord::Schema[7.0].define(version: 2023_09_19_092926) do
# These are extensions that must be enabled in order to support this database
enable_extension "citext"
enable_extension "pg_trgm"
Expand Down Expand Up @@ -254,7 +254,7 @@
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.boolean "dps", default: true
t.boolean "lot", default: false
t.integer "lot", default: 0
end

create_table "frameworks_provider_contacts", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
Expand Down

0 comments on commit a69f525

Please sign in to comment.