Skip to content

Commit

Permalink
Merge branch 'POD-1803_dat_fields' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Albrecht committed Nov 7, 2023
2 parents 1a25209 + 255d9db commit 1376458
Show file tree
Hide file tree
Showing 14 changed files with 144 additions and 140 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ config/settings/*.local.yml
config/environments/*.local.yml
config/secrets.yml

# ignore local crt and key file for self signed ssl
config/localhost.crt
config/localhost.key

# Ignore RubyMine files
.idea/*
.DS_Store
Expand Down
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.7.4
2.7.4
1 change: 1 addition & 0 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ def dp_params
:id, :filename, :comment, :date_digitized, :display_date_digitized, :created_by,
:speed_used, :signal_chain_id, :volume_units, :tape_fluxivity, :peak, :analog_output_voltage,
:stylus_size, :turnover, :rolloff, :noise_reduction, :reference_tone_frequency,
:sample_rate, :digital_to_analog,
:rumble_filter, :_destroy]
)
end
Expand Down
5 changes: 4 additions & 1 deletion app/models/dat_tm.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ class DatTm < ActiveRecord::Base
extend TechnicalMetadatumClassModule
# TM module constants
DIGITAL_PROVENANCE_FILES = ['Digital Master', 'PresInt']
# PROVENANCE_REQUIREMENTS unchanged from default
PROVENANCE_REQUIREMENTS = TechnicalMetadatumModule::PROVENANCE_REQUIREMENTS.merge({
sample_rate: false,
digital_to_analog: false
})
TM_FORMAT = ['DAT']
TM_SUBTYPE = false
TM_GENRE = :audio
Expand Down
4 changes: 4 additions & 0 deletions app/models/digital_file_provenance.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ class DigitalFileProvenance < ActiveRecord::Base
validate :filename_validation
validate :validate_signal_chain

# validation for these?
# sample_rate
# digital_to_analog

default_scope { order(:filename) }

# File Uses:
Expand Down
20 changes: 20 additions & 0 deletions app/views/digital_provenance/_digital_file_provenance.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,26 @@
<%= f.text_field :speed_used, readonly: !@edit_mode, disabled: dp_na(:speed_used), value: dp_na(:speed_used) ? nil : f.object.speed_used %>
</td>
</tr>
<tr <%= 'style=display:none;' if dp_na(:sample_rate) && @hide_dp_na %>>
<th>Sample Rate<%= dp_requirement(:sample_rate) %></th>
<td>
<% if @edit_mode %>
<%= f.select :sample_rate, options_for_select(DatTm::HUMANIZED_COLUMNS.values.collect{|v| [v,v]}, f.object.sample_rate || "48k") %>
<% else %>
<%= f.text_field :sample_rate, readonly: true, disabled: dp_na(:sample_rate), value: dp_na(:sample_rate) ? nil : f.object.sample_rate %>
<% end %>
</td>
</tr>
<tr <%= 'style=display:none;' if dp_na(:digital_to_analog) && @hide_dp_na %>>
<th>Transfer Type<%= dp_requirement(:speed_used) %></th>
<td>
<% if @edit_mode %>
<%= f.select :digital_to_analog, options_for_select([["Digital Transfer", false],["Analog Transfer", true]], f.object.digital_to_analog || false) %>
<% else %>
<%= text_field_tag 'foo', dp_na(:digital_to_analog) ? nil : (f.object.digital_to_analog ? "Analog Transfer" : "Digital Transfer"), { readonly: !@edit_mode, disabled: dp_na(:digital_to_analog) } %>
<% end %>
</td>
</tr>
<tr <%= 'style=display:none;' if dp_na(:tape_fluxivity) && @hide_dp_na %>>
<th>Reference Fluxivity (nWb/m)<%= dp_requirement(:tape_fluxivity) %></th>
<td>
Expand Down
2 changes: 2 additions & 0 deletions app/views/responses/digiprov_metadata.xml.builder
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ xml.pod("xmlns:xsi" => "http://www.w3.org/2001/XMLSchema-instance") do
xml.comment dfp.comment.to_s
xml.created_by dfp.created_by.to_s
xml.speed_used dfp.speed_used.to_s
xml.sample_rate dfp.sample_rate.to_s
xml.digital_to_analog dfp.digital_to_analog.to_s
xml.tape_fluxivity dfp.tape_fluxivity.to_s + (dfp.tape_fluxivity.blank? ? "" : " nWb/m")
xml.volume_units dfp.volume_units.to_s + (dfp.volume_units.blank? ? "" : " dB")
xml.analog_output_voltage dfp.analog_output_voltage.to_s + (dfp.analog_output_voltage.blank? ? "" : " dBu")
Expand Down
2 changes: 2 additions & 0 deletions app/views/responses/full_metadata.xml.builder
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ xml.pod("xmlns:xsi" => "http://www.w3.org/2001/XMLSchema-instance") do
xml.comment dfp.comment
xml.created_by dfp.created_by
xml.speed_used dfp.speed_used
xml.sample_rate dfp.sample_rate
xml.digital_to_analog dfp.digital_to_analog
xml.tape_fluxivity dfp.tape_fluxivity
xml.volume_units dfp.volume_units
xml.analog_output_voltage dfp.analog_output_voltage
Expand Down
5 changes: 3 additions & 2 deletions bin/rails
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#!/usr/bin/env ruby.exe
begin
load File.expand_path("../spring", __FILE__)
rescue LoadError
load File.expand_path('../spring', __FILE__)
rescue LoadError => e
raise unless e.message.include?('spring')
end
APP_PATH = File.expand_path('../../config/application', __FILE__)
require_relative '../config/boot'
Expand Down
5 changes: 3 additions & 2 deletions bin/rake
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#!/usr/bin/env ruby.exe
begin
load File.expand_path("../spring", __FILE__)
rescue LoadError
load File.expand_path('../spring', __FILE__)
rescue LoadError => e
raise unless e.message.include?('spring')
end
require_relative '../config/boot'
require 'rake'
Expand Down
5 changes: 3 additions & 2 deletions bin/rspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#!/usr/bin/env ruby
begin
load File.expand_path("../spring", __FILE__)
rescue LoadError
load File.expand_path('../spring', __FILE__)
rescue LoadError => e
raise unless e.message.include?('spring')
end
require 'bundler/setup'
load Gem.bin_path('rspec-core', 'rspec')
16 changes: 9 additions & 7 deletions bin/spring
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
#!/usr/bin/env ruby

# This file loads spring without using Bundler, in order to be fast.
# This file loads Spring without using Bundler, in order to be fast.
# It gets overwritten when you run the `spring binstub` command.

unless defined?(Spring)
require "rubygems"
require "bundler"
require 'rubygems'
require 'bundler'

if (match = Bundler.default_lockfile.read.match(/^GEM$.*?^ (?: )*spring \((.*?)\)$.*?^$/m))
Gem.paths = { "GEM_PATH" => [Bundler.bundle_path.to_s, *Gem.path].uniq }
gem "spring", match[1]
require "spring/binstub"
lockfile = Bundler::LockfileParser.new(Bundler.default_lockfile.read)
spring = lockfile.specs.detect { |spec| spec.name == 'spring' }
if spring
Gem.use_paths Gem.dir, Bundler.bundle_path.to_s, *Gem.path
gem 'spring', spring.version
require 'spring/binstub'
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
class DigitalFileProvenanceNewDatFields < ActiveRecord::Migration
def change
add_column :digital_file_provenances, :sample_rate, :string
add_column :digital_file_provenances, :digital_to_analog, :boolean
end
end
Loading

0 comments on commit 1376458

Please sign in to comment.