Skip to content

Commit

Permalink
fix: supprot xrd .xy and libs .spec files
Browse files Browse the repository at this point in the history
  • Loading branch information
puglet5 committed Nov 10, 2023
1 parent 79774d1 commit 6a6646f
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 5 deletions.
6 changes: 5 additions & 1 deletion app/models/spectrum.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class Spectrum < RsdbRecord

enum range: { not_set: 0, vis: 1, ir: 2, uv: 3, other: 4 }, _default: :not_set

enum format: { not_set: 0, csv: 1, imp: 2, spectable: 3, mon: 4, txt: 5, dat: 6, dpt: 7, other: 99 }, _default: :not_set, _suffix: :format
enum format: { not_set: 0, csv: 1, imp: 2, spectable: 3, mon: 4, txt: 5, dat: 6, dpt: 7, xy: 8, spec: 9, other: 99 }, _default: :not_set, _suffix: :format

enum category: { not_set: 0, xrf: 1, xrd: 2, ftir: 3, libs: 4, raman: 5, thz: 6, reflectance: 7, other: 99 }, _default: :not_set, _suffix: :type

Expand Down Expand Up @@ -139,12 +139,16 @@ def infer_category
else
other_type!
end
when 'spec'
libs_type!
when 'mon'
if valid_header?(file, :reflectance)
reflectance_type!
else
other_type!
end
when 'xy'
xrd_type!
when 'txt'
if valid_header?(file, :raman)
raman_type!
Expand Down
2 changes: 1 addition & 1 deletion app/views/samples/edit.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
controller: "uploads",
uploads_target: "div",
uploads_filetype_value: "files",
uploads_allowedfiletypes_value: [".dpt", "text/*", ".raw", ".mon", ".csv", ".spectable", ".txt", ".dat"],
uploads_allowedfiletypes_value: [".dpt", "text/*", ".raw", ".mon", ".csv", ".spectable", ".txt", ".dat", ".xy", ".spec"],
uploads_allowmultiplefiles_value: true,
uploads_generatethumbnails_value: current_user.settings(:uploading).thumbnails
} do %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/samples/new.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@
controller: "uploads",
uploads_target: "div",
uploads_filetype_value: "files",
uploads_allowedfiletypes_value: [".dpt", "text/*", ".raw", ".mon", ".csv", ".spectable", ".txt", ".dat"],
uploads_allowedfiletypes_value: [".dpt", "text/*", ".raw", ".mon", ".csv", ".spectable", ".txt", ".dat", ".xy", ".spec"],
uploads_allowmultiplefiles_value: true,
uploads_generatethumbnails_value: current_user.settings(:uploading).thumbnails
} do %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/spectra/edit.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
controller: "uploads",
uploads_target: "div",
uploads_filetype_value: "files",
uploads_allowedfiletypes_value: [".dpt", "text/*", ".raw", ".mon", ".csv", ".spectable", ".txt", ".dat"],
uploads_allowedfiletypes_value: [".dpt", "text/*", ".raw", ".mon", ".csv", ".spectable", ".txt", ".dat", ".xy", ".spec"],
uploads_allowmultiplefiles_value: false,
uploads_generatethumbnails_value: current_user.settings(:uploading).thumbnails
} do %>
Expand Down
2 changes: 1 addition & 1 deletion app/views/spectra/new.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
uploads_target: "div",
uploads_filetype_value: "files",
uploads_allowmultiplefiles_value: false,
uploads_allowedfiletypes_value: [".dpt", "text/*", ".raw", ".mon", ".csv", ".spectable", ".txt", ".dat"],
uploads_allowedfiletypes_value: [".dpt", "text/*", ".raw", ".mon", ".csv", ".spectable", ".txt", ".dat", ".xy", ".spec"],
uploads_generatethumbnails_value: current_user.settings(:uploading).thumbnails
} do %>
<%= render Forms::LabelComponent.new().with_content("Spectrum file") %>
Expand Down

0 comments on commit 6a6646f

Please sign in to comment.