Skip to content
This repository has been archived by the owner on Jul 30, 2020. It is now read-only.

Commit

Permalink
Changed DiveStart, SampleStart and Date fields in db to correct types…
Browse files Browse the repository at this point in the history
…..also changed them to time_select and date_select in view. Added quick link_to references
  • Loading branch information
jeremiaheb committed Mar 13, 2012
1 parent b2dd18c commit 01e8c78
Show file tree
Hide file tree
Showing 7 changed files with 59 additions and 17 deletions.
2 changes: 1 addition & 1 deletion app/models/entrysample.rb
Expand Up @@ -13,7 +13,7 @@ class Entrysample < ActiveRecord::Base
protected

def create_msn
self.mastersampcd = date.to_s(:number) + sampbegh.to_s + sampbegm.to_s + diver_name_id
self.mastersampcd = date.to_s(:number) + sample_start_time.to_formatted_s(:time).gsub(":", "") + diver_name_id
end
end

2 changes: 2 additions & 0 deletions app/views/divers/new.html.erb
Expand Up @@ -12,4 +12,6 @@ List of all Divers:<br />
<% end %>
<% end %>

<hr />
Quick Links: <%= link_to "Divers", new_diver_path %>, <%= link_to "Habitat Types", new_habitattype_path %>, <%= link_to "Sample Types", new_sampletype_path %>, <%= link_to "Entry Sample", new_entrysample_path %>

12 changes: 7 additions & 5 deletions app/views/entrysamples/new.html.erb
Expand Up @@ -4,19 +4,21 @@ Form for sample entry: <br />
BuddyName: <%= f.collection_select(:buddy_name_id, Diver.all, :diver_name_id, :diver_name, {:include_blank => ""}) %> <br />
SampleType: <%= f.collection_select(:sample_type_id, Sampletype.all, :id, :type_name, {:include_blank => ""})%> <br />
HabitatType: <%= f.collection_select(:habitat_type_id, Habitattype.all, :habitat_type_id, :habitat_name, {:include_blank => ""})%> <br />
date: <%= f.text_field :date %> <br />
date: <%= f.date_select :date, {:include_blank => "", :use_month_numbers => true, :order => [:month, :day, :year]} %> <br />
CylinderRadius(m): <%= f.select(:cylinder_radius, [7.5,5], {:include_blank => ""}) %> <br />
Current: <%= f.select(:current, ["none", "mod.", "high"], {:include_blank => ""}) %><br />
MaxDepth: <%= f.text_field :max_depth %><br />
StationDepth: <%= f.text_field :station_depth %><br />
UnderwaterVis: <%= f.text_field :vis %><br />
WaterTemp: <%= f.text_field :water_temp %><br />
DiveStartTime: H<%= f.text_field :divbegh %> M<%= f.text_field :divbegm %><br />
DiveEndTime: H<%= f.text_field :divendh %> M<%= f.text_field :divendm %><br />
SampleStartTime: H<%= f.text_field :sampbegh %> M<%= f.text_field :sampbegm %><br />
SampleEndTime: H<%= f.text_field :sampendh %> M<%= f.text_field :sampendm %><br />
DiveStartTime: <%= f.time_select :dive_start_time, {:include_blank => "", :ampm => true} %><br />
DiveEndTime: <%= f.time_select :dive_end_time, {:include_blank => "", :ampm => true} %><br />
SamppleStartTime: <%= f.time_select :sample_start_time, {:include_blank => "", :ampm => true} %><br />
SampleEndTime: <%= f.time_select :sample_end_time, {:include_blank => "", :ampm => true} %><br />
FishingGear: <%= f.text_field :fishgear %><br />
Comments: <%= f.text_area :comments, :size => "60x12" %><br />
<%= f.submit %>
<% end -%>

<hr />
Quick Links: <%= link_to "Divers", new_diver_path %>, <%= link_to "Habitat Types", new_habitattype_path %>, <%= link_to "Sample Types", new_sampletype_path %>, <%= link_to "Entry Sample", new_entrysample_path %>
3 changes: 3 additions & 0 deletions app/views/habitattypes/new.html.erb
Expand Up @@ -14,3 +14,6 @@ List of all habitat types: <br />
<% else %>
<% end %>

<hr />
Quick Links: <%= link_to "Divers", new_diver_path %>, <%= link_to "Habitat Types", new_habitattype_path %>, <%= link_to "Sample Types", new_sampletype_path %>, <%= link_to "Entry Sample", new_entrysample_path %>
2 changes: 2 additions & 0 deletions app/views/sampletypes/new.html.erb
Expand Up @@ -15,3 +15,5 @@ List of all sampletypes: <br />
<% end %>

<hr />
Quick Links: <%= link_to "Divers", new_diver_path %>, <%= link_to "Habitat Types", new_habitattype_path %>, <%= link_to "Sample Types", new_sampletype_path %>, <%= link_to "Entry Sample", new_entrysample_path %>
37 changes: 37 additions & 0 deletions db/migrate/20120313133403_change_time_fields.rb
@@ -0,0 +1,37 @@
class ChangeTimeFields < ActiveRecord::Migration
def up
remove_column :entrysamples, :divbegh
remove_column :entrysamples, :divbegm
remove_column :entrysamples, :divendh
remove_column :entrysamples, :divendm
remove_column :entrysamples, :sampbegh
remove_column :entrysamples, :sampbegm
remove_column :entrysamples, :sampendh
remove_column :entrysamples, :sampendm

add_column :entrysamples, :dive_start_time, :time
add_column :entrysamples, :dive_end_time, :time
add_column :entrysamples, :sample_start_time, :time
add_column :entrysamples, :sample_end_time, :time


end

def down


remove_column :entrysamples, :sample_end_time
remove_column :entrysamples, :sample_start_time
remove_column :entrysamples, :dive_end_time
remove_column :entrysamples, :dive_start_time

add_column :entrysamples, :sampendm
add_column :entrysamples, :sampendh
add_column :entrysamples, :sampbegm
add_column :entrysamples, :sampbegh
add_column :entrysamples, :divendm
add_column :entrysamples, :divendh
add_column :entrysamples, :divebegm
add_column :entrysamples, :divebegh
end
end
18 changes: 7 additions & 11 deletions db/schema.rb
Expand Up @@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.

ActiveRecord::Schema.define(:version => 20120312154552) do
ActiveRecord::Schema.define(:version => 20120313133403) do

create_table "divers", :force => true do |t|
t.string "diver_name"
Expand All @@ -23,8 +23,8 @@
create_table "entrysamples", :force => true do |t|
t.integer "sample_type_id"
t.date "date"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
t.string "diver_name_id"
t.string "buddy_name_id"
t.integer "habitat_type_id"
Expand All @@ -34,17 +34,13 @@
t.float "station_depth"
t.float "vis"
t.float "water_temp"
t.integer "divbegh"
t.integer "divbegm"
t.integer "divendh"
t.integer "divendm"
t.integer "sampbegh"
t.integer "sampbegm"
t.integer "sampendh"
t.integer "sampendm"
t.text "fishgear"
t.text "comments"
t.string "mastersampcd"
t.time "dive_start_time"
t.time "dive_end_time"
t.time "sample_start_time"
t.time "sample_end_time"
end

create_table "habitattypes", :force => true do |t|
Expand Down

0 comments on commit 01e8c78

Please sign in to comment.