From 5e868bfa879e68e806cf348fe995ddda6708439a Mon Sep 17 00:00:00 2001 From: Matt Moropoulos Date: Tue, 26 Dec 2017 23:49:40 -0800 Subject: [PATCH 1/2] added new part data structure --- .../005_add_material_and_priority_to_parts.rb | 5 ++-- models/.part.rb.swp | Bin 0 -> 12288 bytes models/part.rb | 24 +++++++++++++----- views/part.erb | 5 ++-- views/part_edit.erb | 24 +++++++++++++----- 5 files changed, 38 insertions(+), 20 deletions(-) create mode 100644 models/.part.rb.swp diff --git a/db/migrations/005_add_material_and_priority_to_parts.rb b/db/migrations/005_add_material_and_priority_to_parts.rb index 1a3772d..30d50f3 100644 --- a/db/migrations/005_add_material_and_priority_to_parts.rb +++ b/db/migrations/005_add_material_and_priority_to_parts.rb @@ -1,10 +1,9 @@ Sequel.migration do change do alter_table(:parts) do - add_column :source_material, String, :null => false - add_column :have_material, Integer, :null => false + add_column :mfg_method, String, :null => false + add_column :finish, String, :null => false add_column :quantity, String, :null => false - add_column :cut_length, String, :null => false add_column :priority, Integer, :null => false add_column :drawing_created, Integer, :null => false end diff --git a/models/.part.rb.swp b/models/.part.rb.swp new file mode 100644 index 0000000000000000000000000000000000000000..b80a71461981afaf5bbde155e99f8dd53083ad88 GIT binary patch literal 12288 zcmeHNJ&YSg6rP0N1QHNbbdR+nv-Y&3oT_^JcBv zcJ=B?onERO7r34k;@HJAZ~gh5Wy=Dn|L;asPu zR6LpuWn|*HzIK%#&vBy?wf9zKXIKU-0}sr=A+fkHUuCh9^CCU}+?5B`UUFsSOzQu4r^7=02z&*6 z2`m8r;+ui*fIGldzyW@LT8K{p2{^#tPYLlYa2q%elz@K@3h^881MoHQ5pV}+11|#v z><9J%-y9Gk1T^ph@XM1zd1e7{xfE-Xv9mN2FQlTPtm zs-0vdc~2$q{8Lz}iiL{Zo;w3QM1dL}WevH>nRwnTLw)L3D^s0$>A4t6ojOT;FDL49 zKB(vj9jnoNwVF)WK2W0ue~8xge4`@RvG-CF{$?tDd1IUHGeoy;(QLjHzH?Jk)?{O{ zZrXKC(Fv6W;u_kCG*n(UAv(#Tq&qR9s4UGosud0XzXV_n zMQ4h7*r@x_;qeyW9F3LVt!$`3MbfA|`DNg?I*~%p(JZj#G*gPI*|ica$Fa8Xsh zQ07Nl#>yofkm;#RhM+WMfgd7e22mo0G)_{9bUWFEc$cBZ+REj%mFBfpeYpXDZekB$ zZ#Wmcjh<7c`J}O`qrUXfTu7Ri^w6QL#H6|mLoe7M-K8+{bmW;4d4W+IDx%ov2$p#P zxzb2BlZ>WePa5)Ka=ke8

kd$)*ot6;*^daDbdp`(E5r*y?ObW8B(GM^IR{9r`CQ9>uBfY zxMK&-CQlri9oM8FBzoVJp5d@{bwuM*TNb4qQmEL>8)l~F6vgs^sZwD=dMdQ0q&rGh zN_&$~u*#{DGSIH~eio03Xx=?lChlm{>9vu3nOxD%^<;4N)ns(4_)z)oR2TDssZu)= zq`2l}j5wNI*+D|2F7IY|`;2ke$3nb;P#HEN6;BU8iieAXlDA4q7&g>IDJS&qMcqga z$3CwrRMnKM<+D1|Jo#(7JkWp!}t!I)B-Y-?_A=@Y)sQ z1&Gg+7_8)!6-okAjl(8;nGq$3ot6XB!<0~((?C~xQCkL^m5%Py(S`)SolQEI_0B-x mj1ET;4iiHQ)%gW#D%q!n6UQsG?EAFF12Jqt?Z2+viuey7+gXtS literal 0 HcmV?d00001 diff --git a/models/part.rb b/models/part.rb index 6b1a8ea..2db3d12 100644 --- a/models/part.rb +++ b/models/part.rb @@ -12,19 +12,29 @@ class Part < Sequel::Model # The list of possible part statuses. Key: string stored in database, value: what is displayed to the user. STATUS_MAP = { "designing" => "Design in progress", - "material" => "Material needs to be ordered", +# "material" => "Material needs to be ordered", "ordered" => "Waiting for materials", "drawing" => "Needs drawing", "ready" => "Ready to manufacture", "manufacturing" => "Manufacturing in progress", - "outsourced" => "Waiting for outsourced manufacturing", - "welding" => "Waiting for welding", - "scotchbrite" => "Waiting for Scotch-Brite", - "anodize" => "Ready for anodize", - "powder" => "Ready for powder coating", - "coating" => "Waiting for coating", +# "outsourced" => "Waiting for outsourced manufacturing", +# "welding" => "Waiting for welding", +# "scotchbrite" => "Waiting for Scotch-Brite", +# "anodize" => "Ready for anodize", +# "powder" => "Ready for powder coating", +# "coating" => "Waiting for coating", "assembly" => "Waiting for assembly", "done" => "Done" } + MFG_MAP = { "manual" => "Manual/hand tools", + "milled" => "Milled", + "turned" => "Turned", + "printed" => "3D Printed", + "outsourced" => "Outsourced" } + + FINISH_MAP = { "none" => "None", + "powder_coated" => "Powder coated", + "painted" => "Painted", + "polished" => "Polished" } # Mapping of priority integer stored in database to what is displayed to the user. PRIORITY_MAP = { 0 => "High", 1 => "Normal", 2 => "Low" } diff --git a/views/part.erb b/views/part.erb index 9e65592..b55b02f 100644 --- a/views/part.erb +++ b/views/part.erb @@ -39,9 +39,8 @@ Notes<%= (@part.notes || "").gsub("\n", "
") %> <% if @part.type == "part" %> - Source material<%= @part.source_material %> - Have material?<%= (@part.have_material == 1) ? "Yes" : "No" %> - Material cut length<%= @part.cut_length %> + Manufacturing method<%= @part.mfg_method %> + Finish type<%= @part.finish %> <% end %> Quantity required<%= @part.quantity %> Drawing created?<%= (@part.drawing_created == 1) ? "Yes" : "No" %> diff --git a/views/part_edit.erb b/views/part_edit.erb index 025d32f..b71afaa 100644 --- a/views/part_edit.erb +++ b/views/part_edit.erb @@ -15,20 +15,30 @@ <% end %> + + - - - - - + + +