[Rails] Fertilizer recipe solver for the FAPG.
First commit.
Vive le Castel Peter !
Changed files
- .dockerignore
- .gitattributes
- .gitignore
- .kamal/secrets
- .rubocop.yml
- .ruby-version
- Dockerfile
- Gemfile
- Gemfile.lock
- README.md
- Rakefile
- app/assets/images/.keep
- app/assets/stylesheets/application.css
- app/controllers/application_controller.rb
- app/controllers/concerns/.keep
- app/controllers/crops_controller.rb
- app/controllers/dashboard_controller.rb
- app/controllers/fertilizer_products_controller.rb
- app/controllers/fertilizers_controller.rb
- app/controllers/nutrient_measurement_controller.rb
- app/controllers/rafts_controller.rb
- app/controllers/recipes_controller.rb
- app/helpers/application_helper.rb
- app/helpers/dashboard_helper.rb
- app/helpers/nutrients_helper.rb
- app/helpers/recipes_helper.rb
- app/javascript/application.js
- app/jobs/application_job.rb
- app/mailers/application_mailer.rb
- app/models/application_record.rb
- app/models/bed.rb
- app/models/concerns/.keep
- app/models/crop.rb
- app/models/fertilizer_component.rb
- app/models/fertilizer_composition.rb
- app/models/fertilizer_product.rb
- app/models/nutrient.rb
- app/models/nutrient_measurement.rb
- app/models/raft.rb
- app/services/fertilizer_recipe_calculator.rb
- app/services/target_nutrient_calculator.rb
- app/views/application/_copyright_footer.html.erb
- app/views/application/_navbar.html.erb
- app/views/crops/_crop.html.erb
- app/views/crops/_form.html.erb
- app/views/crops/edit.html.erb
- app/views/crops/index.html.erb
- app/views/crops/new.html.erb
- app/views/crops/show.html.erb
- app/views/dashboard/_raft_allocation.html.erb
- app/views/dashboard/_recent_measurements.html.erb
- app/views/dashboard/_target_table.html.erb
- app/views/dashboard/index.html.erb
- app/views/fertilizer_products/_fertilizer_product.html.erb
- app/views/fertilizer_products/_form.html.erb
- app/views/fertilizer_products/edit.html.erb
- app/views/fertilizer_products/index.html.erb
- app/views/fertilizer_products/new.html.erb
- app/views/fertilizer_products/show.html.erb
- app/views/layouts/application.html.erb
- app/views/layouts/mailer.html.erb
- app/views/layouts/mailer.text.erb
- app/views/nutrient_measurement/index.html.erb
- app/views/pwa/manifest.json.erb
- app/views/pwa/service-worker.js
- app/views/rafts/editor.html.erb
- app/views/recipes/_table.html.erb
- app/views/recipes/show.html.erb
- bin/brakeman
- bin/dev
- bin/docker-entrypoint
- bin/importmap
- bin/rails
- bin/rake
- bin/rubocop
- bin/setup
- bin/thrust
- config.ru
- config/application.rb
- config/boot.rb
- config/cable.yml
- config/credentials.yml.enc
- config/database.yml
- config/deploy.yml
- config/environment.rb
- config/environments/development.rb
- config/environments/production.rb
- config/environments/test.rb
- config/importmap.rb
- config/initializers/assets.rb
- config/initializers/content_security_policy.rb
- config/initializers/filter_parameter_logging.rb
- config/initializers/inflections.rb
- config/locales/en.yml
- config/puma.rb
- config/routes.rb
- config/storage.yml
- db/data/dolibarr_measurements.csv
- db/data/nutrient_requirements.csv
- db/migrate/20250820175727_create_nutrients.rb
- db/migrate/20250820175742_create_nutrient_measurements.rb
- db/migrate/20250823140019_create_crops.rb
- db/migrate/20250823142743_create_beds.rb
- db/migrate/20250823142858_create_rafts.rb
- db/migrate/20250824121914_create_fertilizer_components.rb
- db/migrate/20250824163242_create_fertilizer_products.rb
- db/migrate/20250824163257_create_fertilizer_compositions.rb
- db/schema.rb
- db/seeds.rb
- db/seeds/1_nutrients.rb
- db/seeds/2_nutrient_measurements.rb
- db/seeds/3_crops.rb
- db/seeds/4_beds_and_rafts.rb
- db/seeds/5_fertilizer_components.rb.bkp
- db/seeds/6_fertilizer_products.rb
- lib/tasks/.keep
- log/.keep
- public/400.html
- public/404.html
- public/406-unsupported-browser.html
- public/422.html
- public/500.html
- public/icon.png
- public/icon.svg
- public/robots.txt
- script/.keep
- storage/.keep
- test/application_system_test_case.rb
- test/controllers/crops_controller_test.rb
- test/controllers/dashboard_controller_test.rb
- test/controllers/fertilizer_products_controller_test.rb
- test/controllers/nutrient_measurement_controller_test.rb
- test/controllers/rafts_controller_test.rb
- test/controllers/recipes_controller_test.rb
- test/fixtures/beds.yml
- test/fixtures/crops.yml
- test/fixtures/fertilizer_products.yml
- test/fixtures/files/.keep
- test/fixtures/nutrient_measurements.yml
- test/fixtures/nutrients.yml
- test/fixtures/rafts.yml
- test/helpers/.keep
- test/integration/.keep
- test/mailers/.keep
- test/models/.keep
- test/models/bed_test.rb
- test/models/crop_test.rb
- test/models/fertilizer_composition_test.rb
- test/models/fertilizer_product_test.rb
- test/models/fertilizer_test.rb
- test/models/nutrient_measurement_test.rb
- test/models/nutrient_test.rb
- test/models/raft_test.rb
- test/system/.keep
- test/system/crops_test.rb
- test/system/fertilizer_products_test.rb
- test/test_helper.rb
- tmp/.keep
- tmp/pids/.keep
- tmp/storage/.keep
- vendor/.gitignore
- vendor/bundle/.keep
- vendor/javascript/.keep
.dockerignore
@@ -0,0 +1,51 @@
1
Added:
# See https://docs.docker.com/engine/reference/builder/#dockerignore-file for more about ignoring files.
2
Added:
3
Added:
# Ignore git directory.
4
Added:
/.git/
5
Added:
/.gitignore
6
Added:
7
Added:
# Ignore bundler config.
8
Added:
/.bundle
9
Added:
10
Added:
# Ignore all environment files.
11
Added:
/.env*
12
Added:
13
Added:
# Ignore all default key files.
14
Added:
/config/master.key
15
Added:
/config/credentials/*.key
16
Added:
17
Added:
# Ignore all logfiles and tempfiles.
18
Added:
/log/*
19
Added:
/tmp/*
20
Added:
!/log/.keep
21
Added:
!/tmp/.keep
22
Added:
23
Added:
# Ignore pidfiles, but keep the directory.
24
Added:
/tmp/pids/*
25
Added:
!/tmp/pids/.keep
26
Added:
27
Added:
# Ignore storage (uploaded files in development and any SQLite databases).
28
Added:
/storage/*
29
Added:
!/storage/.keep
30
Added:
/tmp/storage/*
31
Added:
!/tmp/storage/.keep
32
Added:
33
Added:
# Ignore assets.
34
Added:
/node_modules/
35
Added:
/app/assets/builds/*
36
Added:
!/app/assets/builds/.keep
37
Added:
/public/assets
38
Added:
39
Added:
# Ignore CI service files.
40
Added:
/.github
41
Added:
42
Added:
# Ignore Kamal files.
43
Added:
/config/deploy*.yml
44
Added:
/.kamal
45
Added:
46
Added:
# Ignore development files
47
Added:
/.devcontainer
48
Added:
49
Added:
# Ignore Docker-related files
50
Added:
/.dockerignore
51
Added:
/Dockerfile*
.gitattributes
@@ -0,0 +1,9 @@
1
Added:
# See https://git-scm.com/docs/gitattributes for more about git attribute files.
2
Added:
3
Added:
# Mark the database schema as having been generated.
4
Added:
db/schema.rb linguist-generated
5
Added:
6
Added:
# Mark any vendored files as having been vendored.
7
Added:
vendor/* linguist-vendored
8
Added:
config/credentials/*.yml.enc diff=rails_credentials
9
Added:
config/credentials.yml.enc diff=rails_credentials
.gitignore
@@ -0,0 +1,34 @@
1
Added:
# See https://help.github.com/articles/ignoring-files for more about ignoring files.
2
Added:
#
3
Added:
# Temporary files generated by your text editor or operating system
4
Added:
# belong in git's global ignore instead:
5
Added:
# `$XDG_CONFIG_HOME/git/ignore` or `~/.config/git/ignore`
6
Added:
7
Added:
# Ignore bundler config.
8
Added:
/.bundle
9
Added:
10
Added:
# Ignore all environment files.
11
Added:
/.env*
12
Added:
13
Added:
# Ignore all logfiles and tempfiles.
14
Added:
/log/*
15
Added:
/tmp/*
16
Added:
!/log/.keep
17
Added:
!/tmp/.keep
18
Added:
19
Added:
# Ignore pidfiles, but keep the directory.
20
Added:
/tmp/pids/*
21
Added:
!/tmp/pids/
22
Added:
!/tmp/pids/.keep
23
Added:
24
Added:
# Ignore storage (uploaded files in development and any SQLite databases).
25
Added:
/storage/*
26
Added:
!/storage/.keep
27
Added:
/tmp/storage/*
28
Added:
!/tmp/storage/
29
Added:
!/tmp/storage/.keep
30
Added:
31
Added:
/public/assets
32
Added:
33
Added:
# Ignore master key for decrypting credentials and more.
34
Added:
/config/master.key
.kamal/secrets
@@ -0,0 +1,17 @@
1
Added:
# Secrets defined here are available for reference under registry/password, env/secret, builder/secrets,
2
Added:
# and accessories/*/env/secret in config/deploy.yml. All secrets should be pulled from either
3
Added:
# password manager, ENV, or a file. DO NOT ENTER RAW CREDENTIALS HERE! This file needs to be safe for git.
4
Added:
5
Added:
# Example of extracting secrets from 1password (or another compatible pw manager)
6
Added:
# SECRETS=$(kamal secrets fetch --adapter 1password --account your-account --from Vault/Item KAMAL_REGISTRY_PASSWORD RAILS_MASTER_KEY)
7
Added:
# KAMAL_REGISTRY_PASSWORD=$(kamal secrets extract KAMAL_REGISTRY_PASSWORD ${SECRETS})
8
Added:
# RAILS_MASTER_KEY=$(kamal secrets extract RAILS_MASTER_KEY ${SECRETS})
9
Added:
10
Added:
# Use a GITHUB_TOKEN if private repositories are needed for the image
11
Added:
# GITHUB_TOKEN=$(gh config get -h github.com oauth_token)
12
Added:
13
Added:
# Grab the registry password from ENV
14
Added:
KAMAL_REGISTRY_PASSWORD=$KAMAL_REGISTRY_PASSWORD
15
Added:
16
Added:
# Improve security by using a password manager. Never check config/master.key into git!
17
Added:
RAILS_MASTER_KEY=$(cat config/master.key)
.rubocop.yml
@@ -0,0 +1,8 @@
1
Added:
# Omakase Ruby styling for Rails
2
Added:
inherit_gem: { rubocop-rails-omakase: rubocop.yml }
3
Added:
4
Added:
# Overwrite or add rules to create your own house style
5
Added:
#
6
Added:
# # Use `[a, [b, c]]` not `[ a, [ b, c ] ]`
7
Added:
# Layout/SpaceInsideArrayLiteralBrackets:
8
Added:
# Enabled: false
.ruby-version
@@ -0,0 +1,1 @@
1
Added:
ruby-3.2.8
Dockerfile
@@ -0,0 +1,72 @@
1
Added:
# syntax=docker/dockerfile:1
2
Added:
# check=error=true
3
Added:
4
Added:
# This Dockerfile is designed for production, not development. Use with Kamal or build'n'run by hand:
5
Added:
# docker build -t ferti .
6
Added:
# docker run -d -p 80:80 -e RAILS_MASTER_KEY=<value from config/master.key> --name ferti ferti
7
Added:
8
Added:
# For a containerized dev environment, see Dev Containers: https://guides.rubyonrails.org/getting_started_with_devcontainer.html
9
Added:
10
Added:
# Make sure RUBY_VERSION matches the Ruby version in .ruby-version
11
Added:
ARG RUBY_VERSION=3.2.8
12
Added:
FROM docker.io/library/ruby:$RUBY_VERSION-slim AS base
13
Added:
14
Added:
# Rails app lives here
15
Added:
WORKDIR /rails
16
Added:
17
Added:
# Install base packages
18
Added:
RUN apt-get update -qq && \
19
Added:
apt-get install --no-install-recommends -y curl libjemalloc2 libvips sqlite3 && \
20
Added:
rm -rf /var/lib/apt/lists /var/cache/apt/archives
21
Added:
22
Added:
# Set production environment
23
Added:
ENV RAILS_ENV="production" \
24
Added:
BUNDLE_DEPLOYMENT="1" \
25
Added:
BUNDLE_PATH="/usr/local/bundle" \
26
Added:
BUNDLE_WITHOUT="development"
27
Added:
28
Added:
# Throw-away build stage to reduce size of final image
29
Added:
FROM base AS build
30
Added:
31
Added:
# Install packages needed to build gems
32
Added:
RUN apt-get update -qq && \
33
Added:
apt-get install --no-install-recommends -y build-essential git libyaml-dev pkg-config && \
34
Added:
rm -rf /var/lib/apt/lists /var/cache/apt/archives
35
Added:
36
Added:
# Install application gems
37
Added:
COPY Gemfile Gemfile.lock ./
38
Added:
RUN bundle install && \
39
Added:
rm -rf ~/.bundle/ "${BUNDLE_PATH}"/ruby/*/cache "${BUNDLE_PATH}"/ruby/*/bundler/gems/*/.git && \
40
Added:
bundle exec bootsnap precompile --gemfile
41
Added:
42
Added:
# Copy application code
43
Added:
COPY . .
44
Added:
45
Added:
# Precompile bootsnap code for faster boot times
46
Added:
RUN bundle exec bootsnap precompile app/ lib/
47
Added:
48
Added:
# Precompiling assets for production without requiring secret RAILS_MASTER_KEY
49
Added:
RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile
50
Added:
51
Added:
52
Added:
53
Added:
54
Added:
# Final stage for app image
55
Added:
FROM base
56
Added:
57
Added:
# Copy built artifacts: gems, application
58
Added:
COPY --from=build "${BUNDLE_PATH}" "${BUNDLE_PATH}"
59
Added:
COPY --from=build /rails /rails
60
Added:
61
Added:
# Run and own only the runtime files as a non-root user for security
62
Added:
RUN groupadd --system --gid 1000 rails && \
63
Added:
useradd rails --uid 1000 --gid 1000 --create-home --shell /bin/bash && \
64
Added:
chown -R rails:rails db log storage tmp
65
Added:
USER 1000:1000
66
Added:
67
Added:
# Entrypoint prepares the database.
68
Added:
ENTRYPOINT ["/rails/bin/docker-entrypoint"]
69
Added:
70
Added:
# Start server via Thruster by default, this can be overwritten at runtime
71
Added:
EXPOSE 80
72
Added:
CMD ["./bin/thrust", "./bin/rails", "server"]
Gemfile
@@ -0,0 +1,65 @@
1
Added:
source "https://rubygems.org"
2
Added:
3
Added:
# Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main"
4
Added:
gem "rails", "~> 8.0.2", ">= 8.0.2.1"
5
Added:
# The modern asset pipeline for Rails [https://github.com/rails/propshaft]
6
Added:
gem "propshaft"
7
Added:
# Use sqlite3 as the database for Active Record
8
Added:
gem "sqlite3", ">= 2.1"
9
Added:
# Use the Puma web server [https://github.com/puma/puma]
10
Added:
gem "puma", ">= 5.0"
11
Added:
# Use JavaScript with ESM import maps [https://github.com/rails/importmap-rails]
12
Added:
gem "importmap-rails"
13
Added:
# Hotwire's SPA-like page accelerator [https://turbo.hotwired.dev]
14
Added:
gem "turbo-rails"
15
Added:
# Hotwire's modest JavaScript framework [https://stimulus.hotwired.dev]
16
Added:
gem "stimulus-rails"
17
Added:
# Build JSON APIs with ease [https://github.com/rails/jbuilder]
18
Added:
gem "jbuilder"
19
Added:
20
Added:
# Use Active Model has_secure_password [https://guides.rubyonrails.org/active_model_basics.html#securepassword]
21
Added:
# gem "bcrypt", "~> 3.1.7"
22
Added:
23
Added:
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
24
Added:
gem "tzinfo-data", platforms: %i[ windows jruby ]
25
Added:
26
Added:
# Use the database-backed adapters for Rails.cache, Active Job, and Action Cable
27
Added:
gem "solid_cache"
28
Added:
gem "solid_queue"
29
Added:
gem "solid_cable"
30
Added:
31
Added:
# Reduces boot times through caching; required in config/boot.rb
32
Added:
gem "bootsnap", require: false
33
Added:
34
Added:
# Deploy this application anywhere as a Docker container [https://kamal-deploy.org]
35
Added:
gem "kamal", require: false
36
Added:
37
Added:
# Add HTTP asset caching/compression and X-Sendfile acceleration to Puma [https://github.com/basecamp/thruster/]
38
Added:
gem "thruster", require: false
39
Added:
40
Added:
# Use Active Storage variants [https://guides.rubyonrails.org/active_storage_overview.html#transforming-images]
41
Added:
# gem "image_processing", "~> 1.2"
42
Added:
43
Added:
group :development, :test do
44
Added:
# See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem
45
Added:
gem "debug", platforms: %i[ mri windows ], require: "debug/prelude"
46
Added:
47
Added:
# Static analysis for security vulnerabilities [https://brakemanscanner.org/]
48
Added:
gem "brakeman", require: false
49
Added:
50
Added:
# Omakase Ruby styling [https://github.com/rails/rubocop-rails-omakase/]
51
Added:
gem "rubocop-rails-omakase", require: false
52
Added:
end
53
Added:
54
Added:
group :development do
55
Added:
# Use console on exceptions pages [https://github.com/rails/web-console]
56
Added:
gem "web-console"
57
Added:
end
58
Added:
59
Added:
group :test do
60
Added:
# Use system testing [https://guides.rubyonrails.org/testing.html#system-testing]
61
Added:
gem "capybara"
62
Added:
gem "selenium-webdriver"
63
Added:
end
64
Added:
65
Added:
gem "chartkick", "~> 5.2"
Gemfile.lock
@@ -0,0 +1,397 @@
1
Added:
GEM
2
Added:
remote: https://rubygems.org/
3
Added:
specs:
4
Added:
actioncable (8.0.2.1)
5
Added:
actionpack (= 8.0.2.1)
6
Added:
activesupport (= 8.0.2.1)
7
Added:
nio4r (~> 2.0)
8
Added:
websocket-driver (>= 0.6.1)
9
Added:
zeitwerk (~> 2.6)
10
Added:
actionmailbox (8.0.2.1)
11
Added:
actionpack (= 8.0.2.1)
12
Added:
activejob (= 8.0.2.1)
13
Added:
activerecord (= 8.0.2.1)
14
Added:
activestorage (= 8.0.2.1)
15
Added:
activesupport (= 8.0.2.1)
16
Added:
mail (>= 2.8.0)
17
Added:
actionmailer (8.0.2.1)
18
Added:
actionpack (= 8.0.2.1)
19
Added:
actionview (= 8.0.2.1)
20
Added:
activejob (= 8.0.2.1)
21
Added:
activesupport (= 8.0.2.1)
22
Added:
mail (>= 2.8.0)
23
Added:
rails-dom-testing (~> 2.2)
24
Added:
actionpack (8.0.2.1)
25
Added:
actionview (= 8.0.2.1)
26
Added:
activesupport (= 8.0.2.1)
27
Added:
nokogiri (>= 1.8.5)
28
Added:
rack (>= 2.2.4)
29
Added:
rack-session (>= 1.0.1)
30
Added:
rack-test (>= 0.6.3)
31
Added:
rails-dom-testing (~> 2.2)
32
Added:
rails-html-sanitizer (~> 1.6)
33
Added:
useragent (~> 0.16)
34
Added:
actiontext (8.0.2.1)
35
Added:
actionpack (= 8.0.2.1)
36
Added:
activerecord (= 8.0.2.1)
37
Added:
activestorage (= 8.0.2.1)
38
Added:
activesupport (= 8.0.2.1)
39
Added:
globalid (>= 0.6.0)
40
Added:
nokogiri (>= 1.8.5)
41
Added:
actionview (8.0.2.1)
42
Added:
activesupport (= 8.0.2.1)
43
Added:
builder (~> 3.1)
44
Added:
erubi (~> 1.11)
45
Added:
rails-dom-testing (~> 2.2)
46
Added:
rails-html-sanitizer (~> 1.6)
47
Added:
activejob (8.0.2.1)
48
Added:
activesupport (= 8.0.2.1)
49
Added:
globalid (>= 0.3.6)
50
Added:
activemodel (8.0.2.1)
51
Added:
activesupport (= 8.0.2.1)
52
Added:
activerecord (8.0.2.1)
53
Added:
activemodel (= 8.0.2.1)
54
Added:
activesupport (= 8.0.2.1)
55
Added:
timeout (>= 0.4.0)
56
Added:
activestorage (8.0.2.1)
57
Added:
actionpack (= 8.0.2.1)
58
Added:
activejob (= 8.0.2.1)
59
Added:
activerecord (= 8.0.2.1)
60
Added:
activesupport (= 8.0.2.1)
61
Added:
marcel (~> 1.0)
62
Added:
activesupport (8.0.2.1)
63
Added:
base64
64
Added:
benchmark (>= 0.3)
65
Added:
bigdecimal
66
Added:
concurrent-ruby (~> 1.0, >= 1.3.1)
67
Added:
connection_pool (>= 2.2.5)
68
Added:
drb
69
Added:
i18n (>= 1.6, < 2)
70
Added:
logger (>= 1.4.2)
71
Added:
minitest (>= 5.1)
72
Added:
securerandom (>= 0.3)
73
Added:
tzinfo (~> 2.0, >= 2.0.5)
74
Added:
uri (>= 0.13.1)
75
Added:
addressable (2.8.7)
76
Added:
public_suffix (>= 2.0.2, < 7.0)
77
Added:
ast (2.4.3)
78
Added:
base64 (0.3.0)
79
Added:
bcrypt_pbkdf (1.1.1)
80
Added:
bcrypt_pbkdf (1.1.1-arm64-darwin)
81
Added:
bcrypt_pbkdf (1.1.1-x86_64-darwin)
82
Added:
benchmark (0.4.1)
83
Added:
bigdecimal (3.2.2)
84
Added:
bindex (0.8.1)
85
Added:
bootsnap (1.18.6)
86
Added:
msgpack (~> 1.2)
87
Added:
brakeman (7.1.0)
88
Added:
racc
89
Added:
builder (3.3.0)
90
Added:
capybara (3.40.0)
91
Added:
addressable
92
Added:
matrix
93
Added:
mini_mime (>= 0.1.3)
94
Added:
nokogiri (~> 1.11)
95
Added:
rack (>= 1.6.0)
96
Added:
rack-test (>= 0.6.3)
97
Added:
regexp_parser (>= 1.5, < 3.0)
98
Added:
xpath (~> 3.2)
99
Added:
chartkick (5.2.0)
100
Added:
concurrent-ruby (1.3.5)
101
Added:
connection_pool (2.5.3)
102
Added:
crass (1.0.6)
103
Added:
date (3.4.1)
104
Added:
debug (1.11.0)
105
Added:
irb (~> 1.10)
106
Added:
reline (>= 0.3.8)
107
Added:
dotenv (3.1.8)
108
Added:
drb (2.2.3)
109
Added:
ed25519 (1.4.0)
110
Added:
erb (5.0.2)
111
Added:
erubi (1.13.1)
112
Added:
et-orbi (1.3.0)
113
Added:
tzinfo
114
Added:
fugit (1.11.1)
115
Added:
et-orbi (~> 1, >= 1.2.11)
116
Added:
raabro (~> 1.4)
117
Added:
globalid (1.2.1)
118
Added:
activesupport (>= 6.1)
119
Added:
i18n (1.14.7)
120
Added:
concurrent-ruby (~> 1.0)
121
Added:
importmap-rails (2.2.2)
122
Added:
actionpack (>= 6.0.0)
123
Added:
activesupport (>= 6.0.0)
124
Added:
railties (>= 6.0.0)
125
Added:
io-console (0.8.1)
126
Added:
irb (1.15.2)
127
Added:
pp (>= 0.6.0)
128
Added:
rdoc (>= 4.0.0)
129
Added:
reline (>= 0.4.2)
130
Added:
jbuilder (2.14.1)
131
Added:
actionview (>= 7.0.0)
132
Added:
activesupport (>= 7.0.0)
133
Added:
json (2.13.2)
134
Added:
kamal (2.7.0)
135
Added:
activesupport (>= 7.0)
136
Added:
base64 (~> 0.2)
137
Added:
bcrypt_pbkdf (~> 1.0)
138
Added:
concurrent-ruby (~> 1.2)
139
Added:
dotenv (~> 3.1)
140
Added:
ed25519 (~> 1.4)
141
Added:
net-ssh (~> 7.3)
142
Added:
sshkit (>= 1.23.0, < 2.0)
143
Added:
thor (~> 1.3)
144
Added:
zeitwerk (>= 2.6.18, < 3.0)
145
Added:
language_server-protocol (3.17.0.5)
146
Added:
lint_roller (1.1.0)
147
Added:
logger (1.7.0)
148
Added:
loofah (2.24.1)
149
Added:
crass (~> 1.0.2)
150
Added:
nokogiri (>= 1.12.0)
151
Added:
mail (2.8.1)
152
Added:
mini_mime (>= 0.1.1)
153
Added:
net-imap
154
Added:
net-pop
155
Added:
net-smtp
156
Added:
marcel (1.0.4)
157
Added:
matrix (0.4.3)
158
Added:
mini_mime (1.1.5)
159
Added:
minitest (5.25.5)
160
Added:
msgpack (1.8.0)
161
Added:
net-imap (0.5.9)
162
Added:
date
163
Added:
net-protocol
164
Added:
net-pop (0.1.2)
165
Added:
net-protocol
166
Added:
net-protocol (0.2.2)
167
Added:
timeout
168
Added:
net-scp (4.1.0)
169
Added:
net-ssh (>= 2.6.5, < 8.0.0)
170
Added:
net-sftp (4.0.0)
171
Added:
net-ssh (>= 5.0.0, < 8.0.0)
172
Added:
net-smtp (0.5.1)
173
Added:
net-protocol
174
Added:
net-ssh (7.3.0)
175
Added:
nio4r (2.7.4)
176
Added:
nokogiri (1.18.9-aarch64-linux-gnu)
177
Added:
racc (~> 1.4)
178
Added:
nokogiri (1.18.9-aarch64-linux-musl)
179
Added:
racc (~> 1.4)
180
Added:
nokogiri (1.18.9-arm-linux-gnu)
181
Added:
racc (~> 1.4)
182
Added:
nokogiri (1.18.9-arm-linux-musl)
183
Added:
racc (~> 1.4)
184
Added:
nokogiri (1.18.9-arm64-darwin)
185
Added:
racc (~> 1.4)
186
Added:
nokogiri (1.18.9-x86_64-darwin)
187
Added:
racc (~> 1.4)
188
Added:
nokogiri (1.18.9-x86_64-linux-gnu)
189
Added:
racc (~> 1.4)
190
Added:
nokogiri (1.18.9-x86_64-linux-musl)
191
Added:
racc (~> 1.4)
192
Added:
ostruct (0.6.3)
193
Added:
parallel (1.27.0)
194
Added:
parser (3.3.9.0)
195
Added:
ast (~> 2.4.1)
196
Added:
racc
197
Added:
pp (0.6.2)
198
Added:
prettyprint
199
Added:
prettyprint (0.2.0)
200
Added:
prism (1.4.0)
201
Added:
propshaft (1.2.1)
202
Added:
actionpack (>= 7.0.0)
203
Added:
activesupport (>= 7.0.0)
204
Added:
rack
205
Added:
psych (5.2.6)
206
Added:
date
207
Added:
stringio
208
Added:
public_suffix (6.0.2)
209
Added:
puma (6.6.1)
210
Added:
nio4r (~> 2.0)
211
Added:
raabro (1.4.0)
212
Added:
racc (1.8.1)
213
Added:
rack (3.2.0)
214
Added:
rack-session (2.1.1)
215
Added:
base64 (>= 0.1.0)
216
Added:
rack (>= 3.0.0)
217
Added:
rack-test (2.2.0)
218
Added:
rack (>= 1.3)
219
Added:
rackup (2.2.1)
220
Added:
rack (>= 3)
221
Added:
rails (8.0.2.1)
222
Added:
actioncable (= 8.0.2.1)
223
Added:
actionmailbox (= 8.0.2.1)
224
Added:
actionmailer (= 8.0.2.1)
225
Added:
actionpack (= 8.0.2.1)
226
Added:
actiontext (= 8.0.2.1)
227
Added:
actionview (= 8.0.2.1)
228
Added:
activejob (= 8.0.2.1)
229
Added:
activemodel (= 8.0.2.1)
230
Added:
activerecord (= 8.0.2.1)
231
Added:
activestorage (= 8.0.2.1)
232
Added:
activesupport (= 8.0.2.1)
233
Added:
bundler (>= 1.15.0)
234
Added:
railties (= 8.0.2.1)
235
Added:
rails-dom-testing (2.3.0)
236
Added:
activesupport (>= 5.0.0)
237
Added:
minitest
238
Added:
nokogiri (>= 1.6)
239
Added:
rails-html-sanitizer (1.6.2)
240
Added:
loofah (~> 2.21)
241
Added:
nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
242
Added:
railties (8.0.2.1)
243
Added:
actionpack (= 8.0.2.1)
244
Added:
activesupport (= 8.0.2.1)
245
Added:
irb (~> 1.13)
246
Added:
rackup (>= 1.0.0)
247
Added:
rake (>= 12.2)
248
Added:
thor (~> 1.0, >= 1.2.2)
249
Added:
zeitwerk (~> 2.6)
250
Added:
rainbow (3.1.1)
251
Added:
rake (13.3.0)
252
Added:
rdoc (6.14.2)
253
Added:
erb
254
Added:
psych (>= 4.0.0)
255
Added:
regexp_parser (2.11.2)
256
Added:
reline (0.6.2)
257
Added:
io-console (~> 0.5)
258
Added:
rexml (3.4.1)
259
Added:
rubocop (1.79.2)
260
Added:
json (~> 2.3)
261
Added:
language_server-protocol (~> 3.17.0.2)
262
Added:
lint_roller (~> 1.1.0)
263
Added:
parallel (~> 1.10)
264
Added:
parser (>= 3.3.0.2)
265
Added:
rainbow (>= 2.2.2, < 4.0)
266
Added:
regexp_parser (>= 2.9.3, < 3.0)
267
Added:
rubocop-ast (>= 1.46.0, < 2.0)
268
Added:
ruby-progressbar (~> 1.7)
269
Added:
unicode-display_width (>= 2.4.0, < 4.0)
270
Added:
rubocop-ast (1.46.0)
271
Added:
parser (>= 3.3.7.2)
272
Added:
prism (~> 1.4)
273
Added:
rubocop-performance (1.25.0)
274
Added:
lint_roller (~> 1.1)
275
Added:
rubocop (>= 1.75.0, < 2.0)
276
Added:
rubocop-ast (>= 1.38.0, < 2.0)
277
Added:
rubocop-rails (2.33.3)
278
Added:
activesupport (>= 4.2.0)
279
Added:
lint_roller (~> 1.1)
280
Added:
rack (>= 1.1)
281
Added:
rubocop (>= 1.75.0, < 2.0)
282
Added:
rubocop-ast (>= 1.44.0, < 2.0)
283
Added:
rubocop-rails-omakase (1.1.0)
284
Added:
rubocop (>= 1.72)
285
Added:
rubocop-performance (>= 1.24)
286
Added:
rubocop-rails (>= 2.30)
287
Added:
ruby-progressbar (1.13.0)
288
Added:
rubyzip (3.0.1)
289
Added:
securerandom (0.4.1)
290
Added:
selenium-webdriver (4.35.0)
291
Added:
base64 (~> 0.2)
292
Added:
logger (~> 1.4)
293
Added:
rexml (~> 3.2, >= 3.2.5)
294
Added:
rubyzip (>= 1.2.2, < 4.0)
295
Added:
websocket (~> 1.0)
296
Added:
solid_cable (3.0.12)
297
Added:
actioncable (>= 7.2)
298
Added:
activejob (>= 7.2)
299
Added:
activerecord (>= 7.2)
300
Added:
railties (>= 7.2)
301
Added:
solid_cache (1.0.7)
302
Added:
activejob (>= 7.2)
303
Added:
activerecord (>= 7.2)
304
Added:
railties (>= 7.2)
305
Added:
solid_queue (1.2.1)
306
Added:
activejob (>= 7.1)
307
Added:
activerecord (>= 7.1)
308
Added:
concurrent-ruby (>= 1.3.1)
309
Added:
fugit (~> 1.11.0)
310
Added:
railties (>= 7.1)
311
Added:
thor (>= 1.3.1)
312
Added:
sqlite3 (2.7.3-aarch64-linux-gnu)
313
Added:
sqlite3 (2.7.3-aarch64-linux-musl)
314
Added:
sqlite3 (2.7.3-arm-linux-gnu)
315
Added:
sqlite3 (2.7.3-arm-linux-musl)
316
Added:
sqlite3 (2.7.3-arm64-darwin)
317
Added:
sqlite3 (2.7.3-x86_64-darwin)
318
Added:
sqlite3 (2.7.3-x86_64-linux-gnu)
319
Added:
sqlite3 (2.7.3-x86_64-linux-musl)
320
Added:
sshkit (1.24.0)
321
Added:
base64
322
Added:
logger
323
Added:
net-scp (>= 1.1.2)
324
Added:
net-sftp (>= 2.1.2)
325
Added:
net-ssh (>= 2.8.0)
326
Added:
ostruct
327
Added:
stimulus-rails (1.3.4)
328
Added:
railties (>= 6.0.0)
329
Added:
stringio (3.1.7)
330
Added:
thor (1.4.0)
331
Added:
thruster (0.1.15)
332
Added:
thruster (0.1.15-aarch64-linux)
333
Added:
thruster (0.1.15-arm64-darwin)
334
Added:
thruster (0.1.15-x86_64-darwin)
335
Added:
thruster (0.1.15-x86_64-linux)
336
Added:
timeout (0.4.3)
337
Added:
turbo-rails (2.0.16)
338
Added:
actionpack (>= 7.1.0)
339
Added:
railties (>= 7.1.0)
340
Added:
tzinfo (2.0.6)
341
Added:
concurrent-ruby (~> 1.0)
342
Added:
unicode-display_width (3.1.5)
343
Added:
unicode-emoji (~> 4.0, >= 4.0.4)
344
Added:
unicode-emoji (4.0.4)
345
Added:
uri (1.0.3)
346
Added:
useragent (0.16.11)
347
Added:
web-console (4.2.1)
348
Added:
actionview (>= 6.0.0)
349
Added:
activemodel (>= 6.0.0)
350
Added:
bindex (>= 0.4.0)
351
Added:
railties (>= 6.0.0)
352
Added:
websocket (1.2.11)
353
Added:
websocket-driver (0.8.0)
354
Added:
base64
355
Added:
websocket-extensions (>= 0.1.0)
356
Added:
websocket-extensions (0.1.5)
357
Added:
xpath (3.2.0)
358
Added:
nokogiri (~> 1.8)
359
Added:
zeitwerk (2.7.3)
360
Added:
361
Added:
PLATFORMS
362
Added:
aarch64-linux
363
Added:
aarch64-linux-gnu
364
Added:
aarch64-linux-musl
365
Added:
arm-linux-gnu
366
Added:
arm-linux-musl
367
Added:
arm64-darwin
368
Added:
x86_64-darwin
369
Added:
x86_64-linux-gnu
370
Added:
x86_64-linux-musl
371
Added:
372
Added:
DEPENDENCIES
373
Added:
bootsnap
374
Added:
brakeman
375
Added:
capybara
376
Added:
chartkick (~> 5.2)
377
Added:
debug
378
Added:
importmap-rails
379
Added:
jbuilder
380
Added:
kamal
381
Added:
propshaft
382
Added:
puma (>= 5.0)
383
Added:
rails (~> 8.0.2, >= 8.0.2.1)
384
Added:
rubocop-rails-omakase
385
Added:
selenium-webdriver
386
Added:
solid_cable
387
Added:
solid_cache
388
Added:
solid_queue
389
Added:
sqlite3 (>= 2.1)
390
Added:
stimulus-rails
391
Added:
thruster
392
Added:
turbo-rails
393
Added:
tzinfo-data
394
Added:
web-console
395
Added:
396
Added:
BUNDLED WITH
397
Added:
2.6.9
README.md
@@ -0,0 +1,24 @@
1
Added:
# README
2
Added:
3
Added:
This README would normally document whatever steps are necessary to get the
4
Added:
application up and running.
5
Added:
6
Added:
Things you may want to cover:
7
Added:
8
Added:
* Ruby version
9
Added:
10
Added:
* System dependencies
11
Added:
12
Added:
* Configuration
13
Added:
14
Added:
* Database creation
15
Added:
16
Added:
* Database initialization
17
Added:
18
Added:
* How to run the test suite
19
Added:
20
Added:
* Services (job queues, cache servers, search engines, etc.)
21
Added:
22
Added:
* Deployment instructions
23
Added:
24
Added:
* ...
Rakefile
@@ -0,0 +1,6 @@
1
Added:
# Add your own tasks in files placed in lib/tasks ending in .rake,
2
Added:
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
Added:
4
Added:
require_relative "config/application"
5
Added:
6
Added:
Rails.application.load_tasks
app/assets/images/.keep
app/assets/stylesheets/application.css
@@ -0,0 +1,10 @@
1
Added:
/*
2
Added:
* This is a manifest file that'll be compiled into application.css.
3
Added:
*
4
Added:
* With Propshaft, assets are served efficiently without preprocessing steps. You can still include
5
Added:
* application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
6
Added:
* cascading order, meaning styles declared later in the document or manifest will override earlier ones,
7
Added:
* depending on specificity.
8
Added:
*
9
Added:
* Consider organizing styles into separate files for maintainability.
10
Added:
*/
app/controllers/application_controller.rb
@@ -0,0 +1,4 @@
1
Added:
class ApplicationController < ActionController::Base
2
Added:
# Only allow modern browsers supporting webp images, web push, badges, import maps, CSS nesting, and CSS :has.
3
Added:
allow_browser versions: :modern
4
Added:
end
app/controllers/concerns/.keep
app/controllers/crops_controller.rb
@@ -0,0 +1,70 @@
1
Added:
class CropsController < ApplicationController
2
Added:
before_action :set_crop, only: %i[ show edit update destroy ]
3
Added:
4
Added:
# GET /crops or /crops.json
5
Added:
def index
6
Added:
@crops = Crop.all
7
Added:
end
8
Added:
9
Added:
# GET /crops/1 or /crops/1.json
10
Added:
def show
11
Added:
end
12
Added:
13
Added:
# GET /crops/new
14
Added:
def new
15
Added:
@crop = Crop.new
16
Added:
end
17
Added:
18
Added:
# GET /crops/1/edit
19
Added:
def edit
20
Added:
end
21
Added:
22
Added:
# POST /crops or /crops.json
23
Added:
def create
24
Added:
@crop = Crop.new(crop_params)
25
Added:
26
Added:
respond_to do |format|
27
Added:
if @crop.save
28
Added:
format.html { redirect_to @crop, notice: "Crop was successfully created." }
29
Added:
format.json { render :show, status: :created, location: @crop }
30
Added:
else
31
Added:
format.html { render :new, status: :unprocessable_entity }
32
Added:
format.json { render json: @crop.errors, status: :unprocessable_entity }
33
Added:
end
34
Added:
end
35
Added:
end
36
Added:
37
Added:
# PATCH/PUT /crops/1 or /crops/1.json
38
Added:
def update
39
Added:
respond_to do |format|
40
Added:
if @crop.update(crop_params)
41
Added:
format.html { redirect_to @crop, notice: "Crop was successfully updated.", status: :see_other }
42
Added:
format.json { render :show, status: :ok, location: @crop }
43
Added:
else
44
Added:
format.html { render :edit, status: :unprocessable_entity }
45
Added:
format.json { render json: @crop.errors, status: :unprocessable_entity }
46
Added:
end
47
Added:
end
48
Added:
end
49
Added:
50
Added:
# DELETE /crops/1 or /crops/1.json
51
Added:
def destroy
52
Added:
@crop.destroy!
53
Added:
54
Added:
respond_to do |format|
55
Added:
format.html { redirect_to crops_path, notice: "Crop was successfully destroyed.", status: :see_other }
56
Added:
format.json { head :no_content }
57
Added:
end
58
Added:
end
59
Added:
60
Added:
private
61
Added:
# Use callbacks to share common setup or constraints between actions.
62
Added:
def set_crop
63
Added:
@crop = Crop.find(params.expect(:id))
64
Added:
end
65
Added:
66
Added:
# Only allow a list of trusted parameters through.
67
Added:
def crop_params
68
Added:
params.expect(crop: [ :name, :crop_type, :nno3, :p, :k, :ca, :mg, :s, :na, :cl, :si, :fe, :zn, :b, :mn, :cu, :mo, :nnh4 ])
69
Added:
end
70
Added:
end
app/controllers/dashboard_controller.rb
@@ -0,0 +1,45 @@
1
Added:
class DashboardController < ApplicationController
2
Added:
def index
3
Added:
# Raft allocation by crop type
4
Added:
@raft_data = raft_data_series
5
Added:
6
Added:
# Nutrient target table
7
Added:
@latest_measurement = NutrientMeasurement.order(measured_on: :desc, created_at: :desc).first
8
Added:
@target = TargetNutrientCalculator.call
9
Added:
10
Added:
# Measurement history table
11
Added:
@measurements = NutrientMeasurement.order(measured_on: :desc).limit(10)
12
Added:
13
Added:
@npk_measurement_data = measurement_data_series(:nno3, :p, :k)
14
Added:
@ammonium_measurement_data = measurement_data_series(:nnh4)
15
Added:
end
16
Added:
17
Added:
private
18
Added:
19
Added:
def raft_data_series
20
Added:
data_series = []
21
Added:
22
Added:
counts = Raft.left_outer_joins(:crop)
23
Added:
.group("crops.name", "crops.crop_type")
24
Added:
.count
25
Added:
26
Added:
counts.each do |(crop_name, crop_type), count|
27
Added:
name = (crop_name || "unassigned").titleize
28
Added:
type = (crop_type || "unassigned").titleize
29
Added:
data = { type => count }
30
Added:
data_series << { name:, data: }
31
Added:
end
32
Added:
33
Added:
unassigned, assigned = data_series.partition { |s| s[:name].casecmp("unassigned").zero? }
34
Added:
assigned + unassigned
35
Added:
end
36
Added:
37
Added:
def measurement_data_series(*nutrients)
38
Added:
nutrients.map do |formula|
39
Added:
{ name: Nutrient.find_by!(formula:).name,
40
Added:
data: NutrientMeasurement
41
Added:
.order(:measured_on)
42
Added:
.pluck(:measured_on, formula) }
43
Added:
end
44
Added:
end
45
Added:
end
app/controllers/fertilizer_products_controller.rb
@@ -0,0 +1,70 @@
1
Added:
class FertilizerProductsController < ApplicationController
2
Added:
before_action :set_fertilizer_product, only: %i[ show edit update destroy ]
3
Added:
4
Added:
# GET /fertilizer_products or /fertilizer_products.json
5
Added:
def index
6
Added:
@fertilizer_products = FertilizerProduct.all
7
Added:
end
8
Added:
9
Added:
# GET /fertilizer_products/1 or /fertilizer_products/1.json
10
Added:
def show
11
Added:
end
12
Added:
13
Added:
# GET /fertilizer_products/new
14
Added:
def new
15
Added:
@fertilizer_product = FertilizerProduct.new
16
Added:
end
17
Added:
18
Added:
# GET /fertilizer_products/1/edit
19
Added:
def edit
20
Added:
end
21
Added:
22
Added:
# POST /fertilizer_products or /fertilizer_products.json
23
Added:
def create
24
Added:
@fertilizer_product = FertilizerProduct.new(fertilizer_product_params)
25
Added:
26
Added:
respond_to do |format|
27
Added:
if @fertilizer_product.save
28
Added:
format.html { redirect_to @fertilizer_product, notice: "Fertilizer product was successfully created." }
29
Added:
format.json { render :show, status: :created, location: @fertilizer_product }
30
Added:
else
31
Added:
format.html { render :new, status: :unprocessable_entity }
32
Added:
format.json { render json: @fertilizer_product.errors, status: :unprocessable_entity }
33
Added:
end
34
Added:
end
35
Added:
end
36
Added:
37
Added:
# PATCH/PUT /fertilizer_products/1 or /fertilizer_products/1.json
38
Added:
def update
39
Added:
respond_to do |format|
40
Added:
if @fertilizer_product.update(fertilizer_product_params)
41
Added:
format.html { redirect_to @fertilizer_product, notice: "Fertilizer product was successfully updated.", status: :see_other }
42
Added:
format.json { render :show, status: :ok, location: @fertilizer_product }
43
Added:
else
44
Added:
format.html { render :edit, status: :unprocessable_entity }
45
Added:
format.json { render json: @fertilizer_product.errors, status: :unprocessable_entity }
46
Added:
end
47
Added:
end
48
Added:
end
49
Added:
50
Added:
# DELETE /fertilizer_products/1 or /fertilizer_products/1.json
51
Added:
def destroy
52
Added:
@fertilizer_product.destroy!
53
Added:
54
Added:
respond_to do |format|
55
Added:
format.html { redirect_to fertilizer_products_path, notice: "Fertilizer product was successfully destroyed.", status: :see_other }
56
Added:
format.json { head :no_content }
57
Added:
end
58
Added:
end
59
Added:
60
Added:
private
61
Added:
# Use callbacks to share common setup or constraints between actions.
62
Added:
def set_fertilizer_product
63
Added:
@fertilizer_product = FertilizerProduct.find(params.expect(:id))
64
Added:
end
65
Added:
66
Added:
# Only allow a list of trusted parameters through.
67
Added:
def fertilizer_product_params
68
Added:
params.expect(fertilizer_product: [ :name, :purity ])
69
Added:
end
70
Added:
end
app/controllers/fertilizers_controller.rb
@@ -0,0 +1,70 @@
1
Added:
class FertilizersController < ApplicationController
2
Added:
before_action :set_fertilizer, only: %i[ show edit update destroy ]
3
Added:
4
Added:
# GET /fertilizers or /fertilizers.json
5
Added:
def index
6
Added:
@fertilizers = Fertilizer.all
7
Added:
end
8
Added:
9
Added:
# GET /fertilizers/1 or /fertilizers/1.json
10
Added:
def show
11
Added:
end
12
Added:
13
Added:
# GET /fertilizers/new
14
Added:
def new
15
Added:
@fertilizer = Fertilizer.new
16
Added:
end
17
Added:
18
Added:
# GET /fertilizers/1/edit
19
Added:
def edit
20
Added:
end
21
Added:
22
Added:
# POST /fertilizers or /fertilizers.json
23
Added:
def create
24
Added:
@fertilizer = Fertilizer.new(fertilizer_params)
25
Added:
26
Added:
respond_to do |format|
27
Added:
if @fertilizer.save
28
Added:
format.html { redirect_to @fertilizer, notice: "Fertilizer was successfully created." }
29
Added:
format.json { render :show, status: :created, location: @fertilizer }
30
Added:
else
31
Added:
format.html { render :new, status: :unprocessable_entity }
32
Added:
format.json { render json: @fertilizer.errors, status: :unprocessable_entity }
33
Added:
end
34
Added:
end
35
Added:
end
36
Added:
37
Added:
# PATCH/PUT /fertilizers/1 or /fertilizers/1.json
38
Added:
def update
39
Added:
respond_to do |format|
40
Added:
if @fertilizer.update(fertilizer_params)
41
Added:
format.html { redirect_to @fertilizer, notice: "Fertilizer was successfully updated.", status: :see_other }
42
Added:
format.json { render :show, status: :ok, location: @fertilizer }
43
Added:
else
44
Added:
format.html { render :edit, status: :unprocessable_entity }
45
Added:
format.json { render json: @fertilizer.errors, status: :unprocessable_entity }
46
Added:
end
47
Added:
end
48
Added:
end
49
Added:
50
Added:
# DELETE /fertilizers/1 or /fertilizers/1.json
51
Added:
def destroy
52
Added:
@fertilizer.destroy!
53
Added:
54
Added:
respond_to do |format|
55
Added:
format.html { redirect_to fertilizers_path, notice: "Fertilizer was successfully destroyed.", status: :see_other }
56
Added:
format.json { head :no_content }
57
Added:
end
58
Added:
end
59
Added:
60
Added:
private
61
Added:
# Use callbacks to share common setup or constraints between actions.
62
Added:
def set_fertilizer
63
Added:
@fertilizer = Fertilizer.find(params.expect(:id))
64
Added:
end
65
Added:
66
Added:
# Only allow a list of trusted parameters through.
67
Added:
def fertilizer_params
68
Added:
params.expect(fertilizer: [ :name, :formula, :nno3, :nnh4, :p, :k, :ca, :mg, :s, :na, :cl, :si, :fe, :zn, :b, :mn, :cu, :mo ])
69
Added:
end
70
Added:
end
app/controllers/nutrient_measurement_controller.rb
@@ -0,0 +1,4 @@
1
Added:
class NutrientMeasurementController < ApplicationController
2
Added:
def index
3
Added:
end
4
Added:
end
app/controllers/rafts_controller.rb
@@ -0,0 +1,54 @@
1
Added:
class RaftsController < ApplicationController
2
Added:
before_action :set_collections, only: [ :editor ]
3
Added:
4
Added:
def index
5
Added:
redirect_to editor_rafts_path
6
Added:
end
7
Added:
8
Added:
def editor
9
Added:
# @beds, @crops set in before_action
10
Added:
end
11
Added:
12
Added:
# 1) Assign ALL rafts
13
Added:
def assign_all
14
Added:
crop_id = normalized_crop_id(params[:crop_id])
15
Added:
Raft.update_all(crop_id: crop_id) # nil ok
16
Added:
redirect_to editor_rafts_path, notice: "All rafts updated."
17
Added:
end
18
Added:
19
Added:
# 2) Assign all rafts in ONE bed
20
Added:
def assign_bed
21
Added:
bed = Bed.find(params.require(:bed_id))
22
Added:
crop_id = normalized_crop_id(params[:crop_id])
23
Added:
bed.rafts.update_all(crop_id: crop_id)
24
Added:
redirect_to editor_rafts_path, notice: "Bed ##{bed.location} updated."
25
Added:
end
26
Added:
27
Added:
# 3) Assign ONE raft
28
Added:
def assign_one
29
Added:
raft = Raft.find(params[:id])
30
Added:
val = params[:crop_id].to_s
31
Added:
32
Added:
if val.blank? || val.casecmp("null").zero?
33
Added:
# Skip validations; write NULL directly
34
Added:
raft.update_column(:crop_id, nil)
35
Added:
else
36
Added:
raft.update!(crop_id: val)
37
Added:
end
38
Added:
39
Added:
redirect_to editor_rafts_path(anchor: "bed-#{raft.bed_id}"), notice: "Raft updated."
40
Added:
end
41
Added:
42
Added:
private
43
Added:
44
Added:
def set_collections
45
Added:
@beds = Bed.order(:location)
46
Added:
@crops = Crop.order(:name)
47
Added:
end
48
Added:
49
Added:
# Accept "", "null" → nil to allow clearing
50
Added:
def normalized_crop_id(val)
51
Added:
return nil if val.blank? || val.to_s.downcase == "null"
52
Added:
val
53
Added:
end
54
Added:
end
app/controllers/recipes_controller.rb
@@ -0,0 +1,8 @@
1
Added:
class RecipesController < ApplicationController
2
Added:
def show
3
Added:
@latest = NutrientMeasurement.order(:measured_on).last || NutrientMeasurement.new
4
Added:
@target = TargetNutrientCalculator.call
5
Added:
volume = (params[:volume].presence || 100_000).to_i
6
Added:
@recipe = FertilizerRecipeCalculator.call(@latest, @target, water_volume_l: volume)
7
Added:
end
8
Added:
end
app/helpers/application_helper.rb
@@ -0,0 +1,2 @@
1
Added:
module ApplicationHelper
2
Added:
end
app/helpers/dashboard_helper.rb
@@ -0,0 +1,8 @@
1
Added:
module DashboardHelper
2
Added:
def fmt2(v) = number_with_precision(v, precision: 2)
3
Added:
4
Added:
# Total nitrogen (NO3-N + NH4-N)
5
Added:
def total_n(measurement)
6
Added:
(measurement.nno3.to_f) + (measurement.nnh4.to_f)
7
Added:
end
8
Added:
end
app/helpers/nutrients_helper.rb
@@ -0,0 +1,21 @@
1
Added:
module NutrientsHelper
2
Added:
NUTRIENTS = %i[nno3 p k ca mg s na cl si fe zn b mn cu mo nnh4].freeze
3
Added:
4
Added:
def percent_delta(measured, target)
5
Added:
return 0.0 if target.to_f.zero?
6
Added:
((measured.to_f - target.to_f) / target.to_f) * 100.0
7
Added:
end
8
Added:
9
Added:
def fmt(v)
10
Added:
number_with_precision(v, precision: 2, strip_insignificant_zeros: true)
11
Added:
end
12
Added:
13
Added:
def delta_badge_class(delta)
14
Added:
d = delta.abs
15
Added:
case d
16
Added:
when d < 0 then "bg-info"
17
Added:
when 0..5 then "bg-secondary"
18
Added:
else "bg-warning"
19
Added:
end
20
Added:
end
21
Added:
end
app/helpers/recipes_helper.rb
@@ -0,0 +1,16 @@
1
Added:
module RecipesHelper
2
Added:
def commercial_name_for(component)
3
Added:
# Try to find a FertilizerProduct via a join, but gracefully fallback.
4
Added:
if defined?(FertilizerProduct) && defined?(FertilizerComposition)
5
Added:
prod = FertilizerProduct.joins(:fertilizer_compositions)
6
Added:
.where(fertilizer_compositions: { fertilizer_component_id: component.id })
7
Added:
.first
8
Added:
return prod.name if prod&.name.present?
9
Added:
end
10
Added:
component.name.presence || component.formula
11
Added:
end
12
Added:
13
Added:
def fmt_kg(v)
14
Added:
number_with_precision(v.to_f, precision: 2, strip_insignificant_zeros: true)
15
Added:
end
16
Added:
end
app/javascript/application.js
@@ -0,0 +1,1 @@
1
Added:
// Configure your import map in config/importmap.rb. Read more: https://github.com/rails/importmap-rails
app/jobs/application_job.rb
@@ -0,0 +1,7 @@
1
Added:
class ApplicationJob < ActiveJob::Base
2
Added:
# Automatically retry jobs that encountered a deadlock
3
Added:
# retry_on ActiveRecord::Deadlocked
4
Added:
5
Added:
# Most jobs are safe to ignore if the underlying records are no longer available
6
Added:
# discard_on ActiveJob::DeserializationError
7
Added:
end
app/mailers/application_mailer.rb
@@ -0,0 +1,4 @@
1
Added:
class ApplicationMailer < ActionMailer::Base
2
Added:
default from: "from@example.com"
3
Added:
layout "mailer"
4
Added:
end
app/models/application_record.rb
@@ -0,0 +1,3 @@
1
Added:
class ApplicationRecord < ActiveRecord::Base
2
Added:
primary_abstract_class
3
Added:
end
app/models/bed.rb
@@ -0,0 +1,4 @@
1
Added:
class Bed < ApplicationRecord
2
Added:
has_many :rafts, -> { order(:location) }, dependent: :destroy
3
Added:
validates :location, presence: true, uniqueness: true
4
Added:
end
app/models/concerns/.keep
app/models/crop.rb
@@ -0,0 +1,4 @@
1
Added:
class Crop < ApplicationRecord
2
Added:
has_many :rafts
3
Added:
enum :crop_type, { leafy: 0, fruit: 1, herb: 2 }
4
Added:
end
app/models/fertilizer_component.rb
@@ -0,0 +1,3 @@
1
Added:
class FertilizerComponent < ApplicationRecord
2
Added:
validates :name, presence: true
3
Added:
end
app/models/fertilizer_composition.rb
@@ -0,0 +1,6 @@
1
Added:
class FertilizerComposition < ApplicationRecord
2
Added:
belongs_to :fertilizer_product
3
Added:
belongs_to :fertilizer_component
4
Added:
5
Added:
validates :percent_w, numericality: { greater_than: 0, less_than_or_equal_to: 100 }
6
Added:
end
app/models/fertilizer_product.rb
@@ -0,0 +1,7 @@
1
Added:
class FertilizerProduct < ApplicationRecord
2
Added:
has_many :fertilizer_compositions, dependent: :destroy
3
Added:
has_many :fertilizer_components, through: :fertilizer_compositions
4
Added:
5
Added:
validates :name, presence: true, uniqueness: true
6
Added:
validates :purity, numericality: { greater_than: 0, less_than_or_equal_to: 100 }
7
Added:
end
app/models/nutrient.rb
@@ -0,0 +1,7 @@
1
Added:
class Nutrient < ApplicationRecord
2
Added:
validates :formula, presence: true, uniqueness: true
3
Added:
validates :name, presence: true
4
Added:
5
Added:
before_update { raise ActiveRecord::ReadOnlyRecord }
6
Added:
before_destroy { raise ActiveRecord::ReadOnlyRecord }
7
Added:
end
app/models/nutrient_measurement.rb
@@ -0,0 +1,4 @@
1
Added:
class NutrientMeasurement < ApplicationRecord
2
Added:
validates :measured_on, presence: true
3
Added:
validates :measured_on, uniqueness: true
4
Added:
end
app/models/raft.rb
@@ -0,0 +1,5 @@
1
Added:
class Raft < ApplicationRecord
2
Added:
belongs_to :bed
3
Added:
belongs_to :crop
4
Added:
validates :location, presence: true, uniqueness: { scope: :bed_id }
5
Added:
end
app/services/fertilizer_recipe_calculator.rb
@@ -0,0 +1,136 @@
1
Added:
class FertilizerRecipeCalculator
2
Added:
NUTRIENTS = %i[nno3 p k ca mg s nnh4].freeze
3
Added:
4
Added:
def self.call(latest, target, water_volume_l: 100_000)
5
Added:
new(latest, target, water_volume_l).call
6
Added:
end
7
Added:
8
Added:
def initialize(latest, target, water_volume_l)
9
Added:
@latest = latest || NutrientMeasurement.new
10
Added:
@target = target || NutrientMeasurement.new
11
Added:
@vol_l = water_volume_l.to_f
12
Added:
end
13
Added:
14
Added:
# Returns a Hash { FertilizerComponent => qty_kg }
15
Added:
def call
16
Added:
deltas_mg_per_l = NUTRIENTS.index_with do |k|
17
Added:
[ (value(@target, k) - value(@latest, k)), 0 ].max
18
Added:
end
19
Added:
20
Added:
# mg/L * L = mg -> kg
21
Added:
needed_kg = deltas_mg_per_l.transform_values { |mg_l| mg_l * @vol_l / 1_000_000.0 }
22
Added:
23
Added:
recipe = Hash.new(0.0)
24
Added:
25
Added:
# 1) P via MAP or DAP (accounts NH4-N)
26
Added:
if (p_need = needed_kg[:p]) > 0
27
Added:
map = fc_by_formula("MAP") || fc_by_name_like("monoammonium phosphate")
28
Added:
dap = fc_by_formula("DAP") || fc_by_name_like("diammonium phosphate")
29
Added:
carrier = [ map, dap ].compact.find { |c| positive?(c.p) }
30
Added:
if carrier
31
Added:
kg = kg_for(p_need, carrier.p)
32
Added:
recipe[carrier] += kg
33
Added:
needed_kg[:nnh4] = [ needed_kg[:nnh4] - kg * pct(carrier.nnh4), 0 ].max if positive?(carrier.nnh4)
34
Added:
needed_kg[:p] = 0
35
Added:
end
36
Added:
end
37
Added:
38
Added:
# 2) NO3-N via KNO3 then Ca(NO3)2 (accounts K/Ca)
39
Added:
if (n_need = needed_kg[:nno3]) > 0
40
Added:
kno3 = fc_by_formula("KNO3") || fc_by_name_like("potassium nitrate")
41
Added:
can = fc_by_formula("Ca(NO3)2") || fc_by_name_like("calcium nitrate")
42
Added:
43
Added:
if kno3&.nno3.to_f > 0
44
Added:
kg = kg_for(n_need, kno3.nno3)
45
Added:
recipe[kno3] += kg
46
Added:
needed_kg[:k] = [ needed_kg[:k] - kg * pct(kno3.k), 0 ].max
47
Added:
n_need -= kg * pct(kno3.nno3)
48
Added:
end
49
Added:
50
Added:
if n_need > 0 && can&.nno3.to_f > 0
51
Added:
kg = kg_for(n_need, can.nno3)
52
Added:
recipe[can] += kg
53
Added:
needed_kg[:ca] = [ needed_kg[:ca] - kg * pct(can.ca), 0 ].max
54
Added:
n_need = 0
55
Added:
end
56
Added:
57
Added:
needed_kg[:nno3] = [ n_need, 0 ].max
58
Added:
end
59
Added:
60
Added:
# 3) K via K2SO4 (accounts S)
61
Added:
if (k_need = needed_kg[:k]) > 0
62
Added:
sop = fc_by_formula("K2SO4") || fc_by_name_like("potassium sulfate")
63
Added:
if sop&.k.to_f > 0
64
Added:
kg = kg_for(k_need, sop.k)
65
Added:
recipe[sop] += kg
66
Added:
needed_kg[:s] = [ needed_kg[:s] - kg * pct(sop.s), 0 ].max
67
Added:
needed_kg[:k] = 0
68
Added:
end
69
Added:
end
70
Added:
71
Added:
# 4) Ca via Ca(NO3)2 (accounts NO3-N)
72
Added:
if (ca_need = needed_kg[:ca]) > 0
73
Added:
can = recipe.keys.find { |c| norm_formula(c) == "ca(no3)2" } ||
74
Added:
fc_by_formula("Ca(NO3)2") || fc_by_name_like("calcium nitrate")
75
Added:
if can&.ca.to_f > 0
76
Added:
kg = kg_for(ca_need, can.ca)
77
Added:
recipe[can] += kg
78
Added:
needed_kg[:nno3] = [ needed_kg[:nno3] - kg * pct(can.nno3), 0 ].max
79
Added:
needed_kg[:ca] = 0
80
Added:
end
81
Added:
end
82
Added:
83
Added:
# 5) Mg via MgSO4 (accounts S)
84
Added:
if (mg_need = needed_kg[:mg]) > 0
85
Added:
mgs = fc_by_formula("MgSO4") || fc_by_name_like("magnesium sulfate")
86
Added:
if mgs&.mg.to_f > 0
87
Added:
kg = kg_for(mg_need, mgs.mg)
88
Added:
recipe[mgs] += kg
89
Added:
needed_kg[:s] = [ needed_kg[:s] - kg * pct(mgs.s), 0 ].max
90
Added:
needed_kg[:mg] = 0
91
Added:
end
92
Added:
end
93
Added:
94
Added:
# 6) S via K2SO4 or MgSO4 (whichever we already used or find)
95
Added:
if (s_need = needed_kg[:s]) > 0
96
Added:
sop = recipe.keys.find { |c| norm_formula(c) == "k2so4" } ||
97
Added:
fc_by_formula("K2SO4") || fc_by_name_like("potassium sulfate")
98
Added:
mgs = recipe.keys.find { |c| norm_formula(c) == "mgso4" } ||
99
Added:
fc_by_formula("MgSO4") || fc_by_name_like("magnesium sulfate")
100
Added:
carrier = [ sop, mgs ].compact.find { |c| positive?(c.s) }
101
Added:
if carrier
102
Added:
kg = kg_for(s_need, carrier.s)
103
Added:
recipe[carrier] += kg
104
Added:
needed_kg[:k] = [ needed_kg[:k] - kg * pct(carrier.k), 0 ].max if positive?(carrier.k)
105
Added:
needed_kg[:mg] = [ needed_kg[:mg] - kg * pct(carrier.mg), 0 ].max if positive?(carrier.mg)
106
Added:
needed_kg[:s] = 0
107
Added:
end
108
Added:
end
109
Added:
110
Added:
recipe.delete_if { |_c, kg| kg < 0.01 }
111
Added:
recipe
112
Added:
end
113
Added:
114
Added:
private
115
Added:
116
Added:
def value(obj, key) = obj.public_send(key).to_f
117
Added:
118
Added:
def fc_by_formula(formula)
119
Added:
FertilizerComponent.where("LOWER(formula) = ?", formula.to_s.downcase).first
120
Added:
end
121
Added:
122
Added:
def fc_by_name_like(name)
123
Added:
FertilizerComponent.where("LOWER(name) LIKE ?", "%#{name.downcase}%").first
124
Added:
end
125
Added:
126
Added:
def kg_for(need_kg_element, percent_in_product)
127
Added:
return 0.0 unless positive?(percent_in_product)
128
Added:
need_kg_element / pct(percent_in_product)
129
Added:
end
130
Added:
131
Added:
def pct(v) = v.to_f / 100.0
132
Added:
133
Added:
def positive?(v) = v.to_f > 0.0
134
Added:
135
Added:
def norm_formula(c) = c.formula.to_s.downcase.gsub(/\s+/, "")
136
Added:
end
app/services/target_nutrient_calculator.rb
@@ -0,0 +1,33 @@
1
Added:
class TargetNutrientCalculator
2
Added:
# Derive nutrient columns from the NutrientMeasurement table
3
Added:
NUTRIENT_COLUMNS = (NutrientMeasurement.column_names - %w[id measured_on created_at updated_at])
4
Added:
.map!(&:to_sym)
5
Added:
.freeze
6
Added:
7
Added:
# Returns an unsaved NutrientMeasurement with target concentrations (e.g., mg/L)
8
Added:
def self.call
9
Added:
rafts = Raft.includes(:crop).where.not(crop_id: nil)
10
Added:
total = rafts.count
11
Added:
return empty_measurement if total.zero?
12
Added:
13
Added:
sums = Hash.new(0.0)
14
Added:
15
Added:
rafts.each do |raft|
16
Added:
NUTRIENT_COLUMNS.each do |col|
17
Added:
v = raft.crop.public_send(col)
18
Added:
sums[col] += v.to_f if v
19
Added:
end
20
Added:
end
21
Added:
22
Added:
targets = sums.transform_values { |s| s / total }
23
Added:
NutrientMeasurement.new({ measured_on: Date.current }.merge(targets))
24
Added:
end
25
Added:
26
Added:
private
27
Added:
28
Added:
def empty_measurement
29
Added:
NutrientMeasurement.new(
30
Added:
{ measured_on: Date.current }.merge(NUTRIENT_COLUMNS.index_with { 0.0 })
31
Added:
)
32
Added:
end
33
Added:
end
app/views/application/_copyright_footer.html.erb
@@ -0,0 +1,10 @@
1
Added:
<footer class="footer mt-auto py-3">
2
Added:
<div class="container d-flex justify-content-between">
3
Added:
<span class="text-muted">© 2025 FAPG. All rights reserved.</span>
4
Added:
<ul class="list-inline">
5
Added:
<li class="list-inline-item"><a href="#" class="text-muted">Privacy Policy</a></li>
6
Added:
<li class="list-inline-item"><a href="#" class="text-muted">Terms of Use</a></li>
7
Added:
<li class="list-inline-item"><a href="#" class="text-muted">Contact Us</a></li>
8
Added:
</ul>
9
Added:
</div>
10
Added:
</footer>
app/views/application/_navbar.html.erb
@@ -0,0 +1,33 @@
1
Added:
<nav class="navbar navbar-expand-lg navbar-light bg-light">
2
Added:
<div class="container-fluid">
3
Added:
<span class="navbar-brand">FAPG</span>
4
Added:
5
Added:
<button class="navbar-toggler"
6
Added:
type="button"
7
Added:
data-bs-toggle="collapse"
8
Added:
data-bs-target="#navbarSupportedContent"
9
Added:
aria-controls="navbarSupportedContent"
10
Added:
aria-expanded="false"
11
Added:
aria-label="Toggle navigation">
12
Added:
<span class="navbar-toggler-icon"></span>
13
Added:
</button>
14
Added:
15
Added:
<div class="collapse navbar-collapse" id="navbarSupportedContent">
16
Added:
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
17
Added:
<li class="nav-item">
18
Added:
<%= link_to "Home", root_path, class: "nav-link" %>
19
Added:
</li>
20
Added:
<li class="nav-item">
21
Added:
<%= link_to "Ferti", root_path, class: "nav-link" %>
22
Added:
</li>
23
Added:
<li class="nav-item">
24
Added:
<a class="nav-link disabled" href="#" tabindex="-1" aria-disabled="true">Inventory</a>
25
Added:
</li>
26
Added:
<li class="nav-item">
27
Added:
<a class="nav-link disabled" href="#" tabindex="-1" aria-disabled="true">Billing</a>
28
Added:
</li>
29
Added:
</ul>
30
Added:
31
Added:
</div>
32
Added:
</div>
33
Added:
</nav>
app/views/crops/_crop.html.erb
@@ -0,0 +1,92 @@
1
Added:
<div id="<%= dom_id crop %>">
2
Added:
<p>
3
Added:
<strong>Name:</strong>
4
Added:
<%= crop.name %>
5
Added:
</p>
6
Added:
7
Added:
<p>
8
Added:
<strong>Crop type:</strong>
9
Added:
<%= crop.crop_type %>
10
Added:
</p>
11
Added:
12
Added:
<p>
13
Added:
<strong>Nno3:</strong>
14
Added:
<%= crop.nno3 %>
15
Added:
</p>
16
Added:
17
Added:
<p>
18
Added:
<strong>P:</strong>
19
Added:
<%= crop.p %>
20
Added:
</p>
21
Added:
22
Added:
<p>
23
Added:
<strong>K:</strong>
24
Added:
<%= crop.k %>
25
Added:
</p>
26
Added:
27
Added:
<p>
28
Added:
<strong>Ca:</strong>
29
Added:
<%= crop.ca %>
30
Added:
</p>
31
Added:
32
Added:
<p>
33
Added:
<strong>Mg:</strong>
34
Added:
<%= crop.mg %>
35
Added:
</p>
36
Added:
37
Added:
<p>
38
Added:
<strong>S:</strong>
39
Added:
<%= crop.s %>
40
Added:
</p>
41
Added:
42
Added:
<p>
43
Added:
<strong>Na:</strong>
44
Added:
<%= crop.na %>
45
Added:
</p>
46
Added:
47
Added:
<p>
48
Added:
<strong>Cl:</strong>
49
Added:
<%= crop.cl %>
50
Added:
</p>
51
Added:
52
Added:
<p>
53
Added:
<strong>Si:</strong>
54
Added:
<%= crop.si %>
55
Added:
</p>
56
Added:
57
Added:
<p>
58
Added:
<strong>Fe:</strong>
59
Added:
<%= crop.fe %>
60
Added:
</p>
61
Added:
62
Added:
<p>
63
Added:
<strong>Zn:</strong>
64
Added:
<%= crop.zn %>
65
Added:
</p>
66
Added:
67
Added:
<p>
68
Added:
<strong>B:</strong>
69
Added:
<%= crop.b %>
70
Added:
</p>
71
Added:
72
Added:
<p>
73
Added:
<strong>Mn:</strong>
74
Added:
<%= crop.mn %>
75
Added:
</p>
76
Added:
77
Added:
<p>
78
Added:
<strong>Cu:</strong>
79
Added:
<%= crop.cu %>
80
Added:
</p>
81
Added:
82
Added:
<p>
83
Added:
<strong>Mo:</strong>
84
Added:
<%= crop.mo %>
85
Added:
</p>
86
Added:
87
Added:
<p>
88
Added:
<strong>Nnh4:</strong>
89
Added:
<%= crop.nnh4 %>
90
Added:
</p>
91
Added:
92
Added:
</div>
app/views/crops/_form.html.erb
@@ -0,0 +1,107 @@
1
Added:
<%= form_with(model: crop) do |form| %>
2
Added:
<% if crop.errors.any? %>
3
Added:
<div style="color: red">
4
Added:
<h2><%= pluralize(crop.errors.count, "error") %> prohibited this crop from being saved:</h2>
5
Added:
6
Added:
<ul>
7
Added:
<% crop.errors.each do |error| %>
8
Added:
<li><%= error.full_message %></li>
9
Added:
<% end %>
10
Added:
</ul>
11
Added:
</div>
12
Added:
<% end %>
13
Added:
14
Added:
<div>
15
Added:
<%= form.label :name, style: "display: block" %>
16
Added:
<%= form.text_field :name %>
17
Added:
</div>
18
Added:
19
Added:
<div>
20
Added:
<%= form.label :crop_type, style: "display: block" %>
21
Added:
<%= form.number_field :crop_type %>
22
Added:
</div>
23
Added:
24
Added:
<div>
25
Added:
<%= form.label :nno3, style: "display: block" %>
26
Added:
<%= form.text_field :nno3 %>
27
Added:
</div>
28
Added:
29
Added:
<div>
30
Added:
<%= form.label :p, style: "display: block" %>
31
Added:
<%= form.text_field :p %>
32
Added:
</div>
33
Added:
34
Added:
<div>
35
Added:
<%= form.label :k, style: "display: block" %>
36
Added:
<%= form.text_field :k %>
37
Added:
</div>
38
Added:
39
Added:
<div>
40
Added:
<%= form.label :ca, style: "display: block" %>
41
Added:
<%= form.text_field :ca %>
42
Added:
</div>
43
Added:
44
Added:
<div>
45
Added:
<%= form.label :mg, style: "display: block" %>
46
Added:
<%= form.text_field :mg %>
47
Added:
</div>
48
Added:
49
Added:
<div>
50
Added:
<%= form.label :s, style: "display: block" %>
51
Added:
<%= form.text_field :s %>
52
Added:
</div>
53
Added:
54
Added:
<div>
55
Added:
<%= form.label :na, style: "display: block" %>
56
Added:
<%= form.text_field :na %>
57
Added:
</div>
58
Added:
59
Added:
<div>
60
Added:
<%= form.label :cl, style: "display: block" %>
61
Added:
<%= form.text_field :cl %>
62
Added:
</div>
63
Added:
64
Added:
<div>
65
Added:
<%= form.label :si, style: "display: block" %>
66
Added:
<%= form.text_field :si %>
67
Added:
</div>
68
Added:
69
Added:
<div>
70
Added:
<%= form.label :fe, style: "display: block" %>
71
Added:
<%= form.text_field :fe %>
72
Added:
</div>
73
Added:
74
Added:
<div>
75
Added:
<%= form.label :zn, style: "display: block" %>
76
Added:
<%= form.text_field :zn %>
77
Added:
</div>
78
Added:
79
Added:
<div>
80
Added:
<%= form.label :b, style: "display: block" %>
81
Added:
<%= form.text_field :b %>
82
Added:
</div>
83
Added:
84
Added:
<div>
85
Added:
<%= form.label :mn, style: "display: block" %>
86
Added:
<%= form.text_field :mn %>
87
Added:
</div>
88
Added:
89
Added:
<div>
90
Added:
<%= form.label :cu, style: "display: block" %>
91
Added:
<%= form.text_field :cu %>
92
Added:
</div>
93
Added:
94
Added:
<div>
95
Added:
<%= form.label :mo, style: "display: block" %>
96
Added:
<%= form.text_field :mo %>
97
Added:
</div>
98
Added:
99
Added:
<div>
100
Added:
<%= form.label :nnh4, style: "display: block" %>
101
Added:
<%= form.text_field :nnh4 %>
102
Added:
</div>
103
Added:
104
Added:
<div>
105
Added:
<%= form.submit %>
106
Added:
</div>
107
Added:
<% end %>
app/views/crops/edit.html.erb
@@ -0,0 +1,12 @@
1
Added:
<% content_for :title, "Editing crop" %>
2
Added:
3
Added:
<h1>Editing crop</h1>
4
Added:
5
Added:
<%= render "form", crop: @crop %>
6
Added:
7
Added:
<br>
8
Added:
9
Added:
<div>
10
Added:
<%= link_to "Show this crop", @crop %> |
11
Added:
<%= link_to "Back to crops", crops_path %>
12
Added:
</div>
app/views/crops/index.html.erb
@@ -0,0 +1,16 @@
1
Added:
<p style="color: green"><%= notice %></p>
2
Added:
3
Added:
<% content_for :title, "Crops" %>
4
Added:
5
Added:
<h1>Crops</h1>
6
Added:
7
Added:
<div id="crops">
8
Added:
<% @crops.each do |crop| %>
9
Added:
<%= render crop %>
10
Added:
<p>
11
Added:
<%= link_to "Show this crop", crop %>
12
Added:
</p>
13
Added:
<% end %>
14
Added:
</div>
15
Added:
16
Added:
<%= link_to "New crop", new_crop_path %>
app/views/crops/new.html.erb
@@ -0,0 +1,11 @@
1
Added:
<% content_for :title, "New crop" %>
2
Added:
3
Added:
<h1>New crop</h1>
4
Added:
5
Added:
<%= render "form", crop: @crop %>
6
Added:
7
Added:
<br>
8
Added:
9
Added:
<div>
10
Added:
<%= link_to "Back to crops", crops_path %>
11
Added:
</div>
app/views/crops/show.html.erb
@@ -0,0 +1,10 @@
1
Added:
<p style="color: green"><%= notice %></p>
2
Added:
3
Added:
<%= render @crop %>
4
Added:
5
Added:
<div>
6
Added:
<%= link_to "Edit this crop", edit_crop_path(@crop) %> |
7
Added:
<%= link_to "Back to crops", crops_path %>
8
Added:
9
Added:
<%= button_to "Destroy this crop", @crop, method: :delete %>
10
Added:
</div>
app/views/dashboard/_raft_allocation.html.erb
@@ -0,0 +1,9 @@
1
Added:
<div class="card shadow mb-4">
2
Added:
<div class="card-header d-flex justify-content-between align-items-center">
3
Added:
<h5 class="mb-0">Raft Allocation</h5>
4
Added:
<%= link_to "Edit raft allocation", editor_rafts_path, class: "btn btn-sm btn-primary" %>
5
Added:
</div>
6
Added:
7
Added:
<%= bar_chart @raft_data, stacked: true %>
8
Added:
</div>
9
Added:
app/views/dashboard/_recent_measurements.html.erb
@@ -0,0 +1,22 @@
1
Added:
<div class="card shadow mb-4">
2
Added:
<div class="card-header d-flex justify-content-between align-items-center">
3
Added:
<h5 class="mb-0">Nutrient Measurements</h5>
4
Added:
<div class="btn-group">
5
Added:
<%#= link_to "Add new measurement", editor_rafts_path, class: "btn btn-sm btn-primary" %>
6
Added:
<%#= link_to "View all", editor_rafts_path, class: "btn btn-sm btn-secondary" %>
7
Added:
</div>
8
Added:
</div>
9
Added:
10
Added:
<div class="card-body p-0">
11
Added:
<div class="container mb-3">
12
Added:
<%= line_chart @npk_measurement_data,
13
Added:
title: "NPK",
14
Added:
ytitle: "Concentration (mg/L)" %>
15
Added:
</div>
16
Added:
<div class="container mb-3">
17
Added:
<%= line_chart @ammonium_measurement_data,
18
Added:
title: "Ammonium",
19
Added:
ytitle: "Concentration (mg/L)" %>
20
Added:
</div>
21
Added:
</div>
22
Added:
</div>
app/views/dashboard/_target_table.html.erb
@@ -0,0 +1,40 @@
1
Added:
<div class="card shadow mb-4">
2
Added:
<div class="card-header d-flex justify-content-between align-items-center">
3
Added:
<h5 class="mb-0">Target nutrient concentrations</h5>
4
Added:
<%= link_to "Get Ferti© recipe", ferti_recipe_path, class: "btn btn-sm btn-primary" %>
5
Added:
</div>
6
Added:
7
Added:
<div class="table-responsive">
8
Added:
<table class="table table-sm align-middle mb-0">
9
Added:
<thead class="table-light">
10
Added:
<tr>
11
Added:
<th scope="col" class="text-nowrap">Nutrient</th>
12
Added:
<th scope="col" class="text-end"> Latest (mg/L)
13
Added:
</th>
14
Added:
<th scope="col" class="text-end">Target (mg/L)</th>
15
Added:
<th scope="col" class="text-end">Δ %</th>
16
Added:
</tr>
17
Added:
</thead>
18
Added:
<tbody>
19
Added:
<% NutrientsHelper::NUTRIENTS.each do |n| %>
20
Added:
<% latest = @latest_measurement[n] || 0 %>
21
Added:
<% target = @target[n] || 0 %>
22
Added:
<% delta = target - latest %>
23
Added:
<tr>
24
Added:
<th scope="row" class="text-nowrap"><%= n.upcase %></th>
25
Added:
<td class="text-end"><%= fmt(latest) %></td>
26
Added:
<td class="text-end"><%= fmt(target) %></td>
27
Added:
<td class="text-end">
28
Added:
<span class="badge <%= delta_badge_class(delta) %>">
29
Added:
<%= fmt(delta) %>%
30
Added:
</span>
31
Added:
</td>
32
Added:
</tr>
33
Added:
<% end %>
34
Added:
</tbody>
35
Added:
</table>
36
Added:
</div>
37
Added:
<div class="card-footer">
38
Added:
Latest measurement: <%= @latest_measurement.measured_on || "none yet" %>
39
Added:
</div>
40
Added:
</div>
app/views/dashboard/index.html.erb
@@ -0,0 +1,7 @@
1
Added:
<h1 class="display-1">Ferti</h1>
2
Added:
3
Added:
<%= render "raft_allocation" %>
4
Added:
5
Added:
<%= render "target_table" %>
6
Added:
7
Added:
<%= render "recent_measurements" %>
app/views/fertilizer_products/_fertilizer_product.html.erb
@@ -0,0 +1,12 @@
1
Added:
<div id="<%= dom_id fertilizer_product %>">
2
Added:
<p>
3
Added:
<strong>Name:</strong>
4
Added:
<%= fertilizer_product.name %>
5
Added:
</p>
6
Added:
7
Added:
<p>
8
Added:
<strong>Purity:</strong>
9
Added:
<%= fertilizer_product.purity %>
10
Added:
</p>
11
Added:
12
Added:
</div>
app/views/fertilizer_products/_form.html.erb
@@ -0,0 +1,27 @@
1
Added:
<%= form_with(model: fertilizer_product) do |form| %>
2
Added:
<% if fertilizer_product.errors.any? %>
3
Added:
<div style="color: red">
4
Added:
<h2><%= pluralize(fertilizer_product.errors.count, "error") %> prohibited this fertilizer_product from being saved:</h2>
5
Added:
6
Added:
<ul>
7
Added:
<% fertilizer_product.errors.each do |error| %>
8
Added:
<li><%= error.full_message %></li>
9
Added:
<% end %>
10
Added:
</ul>
11
Added:
</div>
12
Added:
<% end %>
13
Added:
14
Added:
<div>
15
Added:
<%= form.label :name, style: "display: block" %>
16
Added:
<%= form.text_field :name %>
17
Added:
</div>
18
Added:
19
Added:
<div>
20
Added:
<%= form.label :purity, style: "display: block" %>
21
Added:
<%= form.text_field :purity %>
22
Added:
</div>
23
Added:
24
Added:
<div>
25
Added:
<%= form.submit %>
26
Added:
</div>
27
Added:
<% end %>
app/views/fertilizer_products/edit.html.erb
@@ -0,0 +1,12 @@
1
Added:
<% content_for :title, "Editing fertilizer product" %>
2
Added:
3
Added:
<h1>Editing fertilizer product</h1>
4
Added:
5
Added:
<%= render "form", fertilizer_product: @fertilizer_product %>
6
Added:
7
Added:
<br>
8
Added:
9
Added:
<div>
10
Added:
<%= link_to "Show this fertilizer product", @fertilizer_product %> |
11
Added:
<%= link_to "Back to fertilizer products", fertilizer_products_path %>
12
Added:
</div>
app/views/fertilizer_products/index.html.erb
@@ -0,0 +1,16 @@
1
Added:
<p style="color: green"><%= notice %></p>
2
Added:
3
Added:
<% content_for :title, "Fertilizer products" %>
4
Added:
5
Added:
<h1>Fertilizer products</h1>
6
Added:
7
Added:
<div id="fertilizer_products">
8
Added:
<% @fertilizer_products.each do |fertilizer_product| %>
9
Added:
<%= render fertilizer_product %>
10
Added:
<p>
11
Added:
<%= link_to "Show this fertilizer product", fertilizer_product %>
12
Added:
</p>
13
Added:
<% end %>
14
Added:
</div>
15
Added:
16
Added:
<%= link_to "New fertilizer product", new_fertilizer_product_path %>
app/views/fertilizer_products/new.html.erb
@@ -0,0 +1,11 @@
1
Added:
<% content_for :title, "New fertilizer product" %>
2
Added:
3
Added:
<h1>New fertilizer product</h1>
4
Added:
5
Added:
<%= render "form", fertilizer_product: @fertilizer_product %>
6
Added:
7
Added:
<br>
8
Added:
9
Added:
<div>
10
Added:
<%= link_to "Back to fertilizer products", fertilizer_products_path %>
11
Added:
</div>
app/views/fertilizer_products/show.html.erb
@@ -0,0 +1,10 @@
1
Added:
<p style="color: green"><%= notice %></p>
2
Added:
3
Added:
<%= render @fertilizer_product %>
4
Added:
5
Added:
<div>
6
Added:
<%= link_to "Edit this fertilizer product", edit_fertilizer_product_path(@fertilizer_product) %> |
7
Added:
<%= link_to "Back to fertilizer products", fertilizer_products_path %>
8
Added:
9
Added:
<%= button_to "Destroy this fertilizer product", @fertilizer_product, method: :delete %>
10
Added:
</div>
app/views/layouts/application.html.erb
@@ -0,0 +1,46 @@
1
Added:
<!DOCTYPE html>
2
Added:
<html>
3
Added:
<head>
4
Added:
<title><%= content_for(:title) || "Ferti" %></title>
5
Added:
<meta name="viewport" content="width=device-width,initial-scale=1">
6
Added:
<meta name="apple-mobile-web-app-capable" content="yes">
7
Added:
<meta name="mobile-web-app-capable" content="yes">
8
Added:
<%= csrf_meta_tags %>
9
Added:
<%= csp_meta_tag %>
10
Added:
11
Added:
<%= yield :head %>
12
Added:
13
Added:
<%# Enable PWA manifest for installable apps (make sure to enable in config/routes.rb too!) %>
14
Added:
<%#= tag.link rel: "manifest", href: pwa_manifest_path(format: :json) %>
15
Added:
16
Added:
<link rel="icon" href="/icon.png" type="image/png">
17
Added:
<link rel="icon" href="/icon.svg" type="image/svg+xml">
18
Added:
<link rel="apple-touch-icon" href="/icon.png">
19
Added:
20
Added:
<%# Includes all stylesheet files in app/assets/stylesheets %>
21
Added:
<%= stylesheet_link_tag :app, "data-turbo-track": "reload" %>
22
Added:
23
Added:
<!-- Bootstrap 5 CSS -->
24
Added:
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
25
Added:
26
Added:
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
27
Added:
<script src="https://cdn.jsdelivr.net/npm/chartkick@5"></script>
28
Added:
29
Added:
<script src="https://cdn.jsdelivr.net/npm/chartjs-adapter-date-fns/dist/chartjs-adapter-date-fns.bundle.min.js"></script>
30
Added:
31
Added:
<%= javascript_importmap_tags %>
32
Added:
</head>
33
Added:
34
Added:
<body>
35
Added:
<%= render "application/navbar" %>
36
Added:
37
Added:
<div class="container">
38
Added:
<%= yield %>
39
Added:
</div>
40
Added:
41
Added:
<%= render "application/copyright_footer" %>
42
Added:
43
Added:
<!-- Bootstrap JS (optional, for dropdowns, etc.) -->
44
Added:
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
45
Added:
</body>
46
Added:
</html>
app/views/layouts/mailer.html.erb
@@ -0,0 +1,13 @@
1
Added:
<!DOCTYPE html>
2
Added:
<html>
3
Added:
<head>
4
Added:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
5
Added:
<style>
6
Added:
/* Email styles need to be inline */
7
Added:
</style>
8
Added:
</head>
9
Added:
10
Added:
<body>
11
Added:
<%= yield %>
12
Added:
</body>
13
Added:
</html>
app/views/layouts/mailer.text.erb
@@ -0,0 +1,1 @@
1
Added:
<%= yield %>
app/views/nutrient_measurement/index.html.erb
@@ -0,0 +1,27 @@
1
Added:
<h1>NutrientMeasurement#index</h1>
2
Added:
<p>Find me in app/views/nutrient_measurement/index.html.erb</p>
3
Added:
4
Added:
<div class="table-responsive">
5
Added:
<table class="table table-sm table-striped table-hover align-middle table-nutrient mb-0">
6
Added:
<thead class="table-light">
7
Added:
<tr>
8
Added:
<th>Date</th>
9
Added:
<th class="numeric" title="Total N = NO₃‑N + NH₄‑N">N (total)</th>
10
Added:
<th class="numeric">P</th>
11
Added:
<th class="numeric">K</th>
12
Added:
<th class="numeric" title="Ammonia nitrogen">NH₄‑N</th>
13
Added:
</tr>
14
Added:
</thead>
15
Added:
<tbody>
16
Added:
<% @measurements.each do |m| %>
17
Added:
<tr>
18
Added:
<td><%= l(m.measured_on) %></td>
19
Added:
<td class="numeric"><%= fmt2(total_n(m)) %></td>
20
Added:
<td class="numeric"><%= fmt2(m.p) %></td>
21
Added:
<td class="numeric"><%= fmt2(m.k) %></td>
22
Added:
<td class="numeric"><%= fmt2(m.nnh4) %></td>
23
Added:
</tr>
24
Added:
<% end %>
25
Added:
</tbody>
26
Added:
</table>
27
Added:
</div>
app/views/pwa/manifest.json.erb
@@ -0,0 +1,22 @@
1
Added:
{
2
Added:
"name": "Ferti",
3
Added:
"icons": [
4
Added:
{
5
Added:
"src": "/icon.png",
6
Added:
"type": "image/png",
7
Added:
"sizes": "512x512"
8
Added:
},
9
Added:
{
10
Added:
"src": "/icon.png",
11
Added:
"type": "image/png",
12
Added:
"sizes": "512x512",
13
Added:
"purpose": "maskable"
14
Added:
}
15
Added:
],
16
Added:
"start_url": "/",
17
Added:
"display": "standalone",
18
Added:
"scope": "/",
19
Added:
"description": "Ferti.",
20
Added:
"theme_color": "red",
21
Added:
"background_color": "red"
22
Added:
}
app/views/pwa/service-worker.js
@@ -0,0 +1,26 @@
1
Added:
// Add a service worker for processing Web Push notifications:
2
Added:
//
3
Added:
// self.addEventListener("push", async (event) => {
4
Added:
// const { title, options } = await event.data.json()
5
Added:
// event.waitUntil(self.registration.showNotification(title, options))
6
Added:
// })
7
Added:
//
8
Added:
// self.addEventListener("notificationclick", function(event) {
9
Added:
// event.notification.close()
10
Added:
// event.waitUntil(
11
Added:
// clients.matchAll({ type: "window" }).then((clientList) => {
12
Added:
// for (let i = 0; i < clientList.length; i++) {
13
Added:
// let client = clientList[i]
14
Added:
// let clientPath = (new URL(client.url)).pathname
15
Added:
//
16
Added:
// if (clientPath == event.notification.data.path && "focus" in client) {
17
Added:
// return client.focus()
18
Added:
// }
19
Added:
// }
20
Added:
//
21
Added:
// if (clients.openWindow) {
22
Added:
// return clients.openWindow(event.notification.data.path)
23
Added:
// }
24
Added:
// })
25
Added:
// )
26
Added:
// })
app/views/rafts/editor.html.erb
@@ -0,0 +1,108 @@
1
Added:
<div class="d-flex justify-content-between align-items-center mb-3">
2
Added:
<h1 class="display-1">Rafts editor</h1>
3
Added:
<%= link_to "Back to dashboard", root_path, class: "btn btn-outline-secondary" %>
4
Added:
</div>
5
Added:
6
Added:
<!-- Bulk assign all rafts -->
7
Added:
<div class="card">
8
Added:
<div class="card-header">Assign ALL rafts</div>
9
Added:
<div class="card-body">
10
Added:
<%= form_with url: assign_all_rafts_path, method: :patch, class: "row g-2", data: { turbo: false } do %>
11
Added:
<div class="col-12 col-md-6">
12
Added:
<select class="form-select" name="crop_id">
13
Added:
<option value="">— Unassigned (clear) —</option>
14
Added:
<% @crops.each do |crop| %>
15
Added:
<option value="<%= crop.id %>"><%= crop.name %></option>
16
Added:
<% end %>
17
Added:
</select>
18
Added:
</div>
19
Added:
<div class="col-12 col-md-auto">
20
Added:
<button class="btn btn-primary">Apply to all</button>
21
Added:
</div>
22
Added:
<% end %>
23
Added:
</div>
24
Added:
</div>
25
Added:
26
Added:
<div class="table-responsive">
27
Added:
<table class="table table-sm table-striped text-center align-middle my-3">
28
Added:
<thead>
29
Added:
<tr>
30
Added:
<th class="text-start">Bed</th>
31
Added:
<% max_cols = @beds.map { |b| b.rafts.count }.max %>
32
Added:
<% (1..max_cols).each do |i| %>
33
Added:
<th>R<%= i %></th>
34
Added:
<% end %>
35
Added:
</tr>
36
Added:
</thead>
37
Added:
<tbody>
38
Added:
<% @beds.each do |bed| %>
39
Added:
<tr>
40
Added:
<th><%= bed.location %></th>
41
Added:
<% bed.rafts.order(:location).each do |raft| %>
42
Added:
<td>
43
Added:
<% if raft.crop %>
44
Added:
<%= raft.crop.name %>
45
Added:
<% else %>
46
Added:
—
47
Added:
<% end %>
48
Added:
</td>
49
Added:
<% end %>
50
Added:
</tr>
51
Added:
<% end %>
52
Added:
</tbody>
53
Added:
</table>
54
Added:
</div>
55
Added:
56
Added:
<!-- Per-bed tables -->
57
Added:
<% @beds.each do |bed| %>
58
Added:
<div class="card mb-3" id="bed-<%= bed.id %>">
59
Added:
<div class="card-header d-flex flex-wrap gap-2 align-items-center">
60
Added:
<span class="me-auto">Bed <strong>#<%= bed.location %></strong></span>
61
Added:
<%= form_with url: assign_bed_rafts_path, method: :patch, class: "d-flex gap-2 align-items-center", data: { turbo: false } do %>
62
Added:
<input type="hidden" name="bed_id" value="<%= bed.id %>">
63
Added:
<select class="form-select" name="crop_id">
64
Added:
<option value="">— Unassigned (clear) —</option>
65
Added:
<% @crops.each do |crop| %>
66
Added:
<option value="<%= crop.id %>"><%= crop.name %></option>
67
Added:
<% end %>
68
Added:
</select>
69
Added:
<button class="btn btn-primary">Apply</button>
70
Added:
<% end %>
71
Added:
</div>
72
Added:
<div class="card-body p-0">
73
Added:
<div class="table-responsive">
74
Added:
<table class="table table-sm mb-0 align-middle">
75
Added:
<thead class="table-light">
76
Added:
<tr>
77
Added:
<th class="text-nowrap text-center">Raft</th>
78
Added:
<th>Crop</th>
79
Added:
<th class="text-end">Actions</th>
80
Added:
</tr>
81
Added:
</thead>
82
Added:
<tbody>
83
Added:
<% bed.rafts.order(:location).each do |raft| %>
84
Added:
<tr>
85
Added:
<td class="text-center"><strong><%= raft.location %></strong></td>
86
Added:
<td style="max-width: 280px;">
87
Added:
<%= form_with url: assign_one_raft_path(raft), method: :patch, class: "d-flex gap-2", data: { turbo: false } do %>
88
Added:
<select class="form-select" name="crop_id">
89
Added:
<option value="">— Unassigned (clear) —</option>
90
Added:
<% @crops.each do |crop| %>
91
Added:
<option value="<%= crop.id %>" <%= "selected" if raft.crop_id == crop.id %>><%= crop.name %></option>
92
Added:
<% end %>
93
Added:
</select>
94
Added:
<button class="btn btn-outline-primary">Save</button>
95
Added:
<% end %>
96
Added:
</td>
97
Added:
<td class="text-end">
98
Added:
<%= button_to "Clear", assign_one_raft_path(raft, crop_id: ""), method: :patch,
99
Added:
form: { data: { turbo: false } }, class: "btn btn-outline-secondary btn-sm" %>
100
Added:
</td>
101
Added:
</tr>
102
Added:
<% end %>
103
Added:
</tbody>
104
Added:
</table>
105
Added:
</div>
106
Added:
</div>
107
Added:
</div>
108
Added:
<% end %>
app/views/recipes/_table.html.erb
@@ -0,0 +1,32 @@
1
Added:
<div class="table-responsive">
2
Added:
<table class="table table-sm align-middle mb-0">
3
Added:
<thead class="table-light">
4
Added:
<tr>
5
Added:
<th>Fertilizer product</th>
6
Added:
<th class="text-muted">Component</th>
7
Added:
<th class="text-end">Qty (kg)</th>
8
Added:
<th class="text-end">Per portion (kg)</th>
9
Added:
</tr>
10
Added:
</thead>
11
Added:
<tbody>
12
Added:
<% pcount = [[portions.to_i, 2].max, 10].min %>
13
Added:
<% recipe&.each do |component, kg| %>
14
Added:
<% prod_name = commercial_name_for(component) %>
15
Added:
<tr>
16
Added:
<td><strong><%= prod_name %></strong></td>
17
Added:
<td class="text-muted"><small><%= component.name %></small></td>
18
Added:
<td class="text-end fw-semibold"><%= fmt_kg(kg) %></td>
19
Added:
<td class="text-end"><%= fmt_kg(kg / pcount.to_f) %></td>
20
Added:
</tr>
21
Added:
<% end %>
22
Added:
<% if recipe.blank? %>
23
Added:
<tr><td colspan="4" class="text-center text-muted">No supplementation required.</td></tr>
24
Added:
<% end %>
25
Added:
</tbody>
26
Added:
</table>
27
Added:
</div>
28
Added:
29
Added:
<div class="card-footer small text-muted">
30
Added:
Volume: <%= number_with_delimiter(volume) %> L —
31
Added:
Portions: <%= pcount %>
32
Added:
</div>
app/views/recipes/show.html.erb
@@ -0,0 +1,108 @@
1
Added:
<!-- app/views/recipes/show.html.erb -->
2
Added:
<%# Controls header %>
3
Added:
<div class="card shadow my-4">
4
Added:
<div class="card-header d-flex flex-wrap gap-2 justify-content-between align-items-center">
5
Added:
<h5 class="mb-0">Ferti© Recipe</h5>
6
Added:
7
Added:
<div class="d-flex flex-wrap gap-2 align-items-center">
8
Added:
<%= form_with url: ferti_recipe_path, method: :get, local: true, class: "d-flex flex-wrap gap-2 align-items-center", id: "recipe-form" do %>
9
Added:
<div class="d-flex align-items-center gap-2">
10
Added:
<label class="mb-0 small text-nowrap" for="volume_select">Volume</label>
11
Added:
<select id="volume_select" name="volume" class="form-select form-select-sm">
12
Added:
<% options = [["100 000 L", 100_000], ["200 000 L", 200_000], ["300 000 L", 300_000]] %>
13
Added:
<% current_volume = (params[:volume].presence || 100_000).to_i %>
14
Added:
<% options.each do |label, val| %>
15
Added:
<option value="<%= val %>" <%= 'selected' if val == current_volume %>><%= label %></option>
16
Added:
<% end %>
17
Added:
</select>
18
Added:
</div>
19
Added:
20
Added:
<div class="vr" style="height: 24px;"></div>
21
Added:
22
Added:
<div class="d-flex align-items-center gap-2">
23
Added:
<label class="mb-0 small text-nowrap" for="portions_input">Portions</label>
24
Added:
<input id="portions_input" type="number" min="2" max="10" step="1"
25
Added:
class="form-control form-control-sm" value="<%= params[:portions].presence || 2 %>">
26
Added:
</div>
27
Added:
<% end %>
28
Added:
29
Added:
<%= link_to "Back", root_path, class: "btn btn-sm btn-secondary" %>
30
Added:
</div>
31
Added:
</div>
32
Added:
33
Added:
<div class="table-responsive">
34
Added:
<table class="table table-sm align-middle mb-0" id="recipe-table">
35
Added:
<thead class="table-light">
36
Added:
<tr>
37
Added:
<th>Product</th>
38
Added:
<th class="text-muted">Fertilizer</th>
39
Added:
<th class="text-end">Qty (kg)</th>
40
Added:
<th class="text-end">Per portion (kg)</th>
41
Added:
</tr>
42
Added:
</thead>
43
Added:
<tbody>
44
Added:
<% @recipe.each do |component, kg| %>
45
Added:
<% prod_name = commercial_name_for(component) %>
46
Added:
<tr data-total-kg="<%= kg %>">
47
Added:
<td><strong><%= prod_name %></strong></td>
48
Added:
<td class="text-muted"><small><%= component.name %></small></td>
49
Added:
<td class="text-end fw-semibold"><%= fmt_kg(kg) %></td>
50
Added:
<td class="text-end per-portion-cell"><%= fmt_kg(kg / (params[:portions].presence || 2).to_f) %></td>
51
Added:
</tr>
52
Added:
<% end %>
53
Added:
<% if @recipe.blank? %>
54
Added:
<tr><td colspan="4" class="text-center text-muted">No supplementation required.</td></tr>
55
Added:
<% end %>
56
Added:
</tbody>
57
Added:
</table>
58
Added:
</div>
59
Added:
60
Added:
<div class="card-footer small text-muted">
61
Added:
Recipe based on latest measurement: <%= @latest.measured_on %>
62
Added:
</div>
63
Added:
</div>
64
Added:
65
Added:
<%# Tiny vanilla JS: auto-submit on volume change; live per-portion update %>
66
Added:
<script>
67
Added:
(function() {
68
Added:
const form = document.getElementById('recipe-form');
69
Added:
const volumeSelect = document.getElementById('volume_select');
70
Added:
const portionsInput = document.getElementById('portions_input');
71
Added:
const rows = document.querySelectorAll('#recipe-table tbody tr[data-total-kg]');
72
Added:
73
Added:
function clampPortions(n) {
74
Added:
n = parseInt(n || 2, 10);
75
Added:
if (isNaN(n)) n = 2;
76
Added:
return Math.min(10, Math.max(2, n));
77
Added:
}
78
Added:
79
Added:
function updatePerPortion() {
80
Added:
const n = clampPortions(portionsInput.value);
81
Added:
portionsInput.value = n;
82
Added:
rows.forEach(row => {
83
Added:
const total = parseFloat(row.getAttribute('data-total-kg') || '0');
84
Added:
const cell = row.querySelector('.per-portion-cell');
85
Added:
const per = (n > 0) ? (total / n) : 0;
86
Added:
cell.textContent = formatKg(per);
87
Added:
});
88
Added:
}
89
Added:
90
Added:
function formatKg(v) {
91
Added:
// match Rails number_with_precision(... precision: 2, strip zeros-ish)
92
Added:
const s = (Math.round(v * 100) / 100).toFixed(2);
93
Added:
return s.replace(/\.00$/, '').replace(/(\.\d)0$/, '$1');
94
Added:
}
95
Added:
96
Added:
volumeSelect.addEventListener('change', () => {
97
Added:
// submit with selected volume, keeping portions as a query param
98
Added:
const portions = clampPortions(portionsInput.value);
99
Added:
const url = new URL(form.action, window.location.origin);
100
Added:
url.searchParams.set('volume', volumeSelect.value);
101
Added:
url.searchParams.set('portions', portions);
102
Added:
window.location.assign(url.toString());
103
Added:
});
104
Added:
105
Added:
portionsInput.addEventListener('input', updatePerPortion);
106
Added:
updatePerPortion();
107
Added:
})();
108
Added:
</script>
bin/brakeman
@@ -0,0 +1,7 @@
1
Added:
#!/usr/bin/env ruby
2
Added:
require "rubygems"
3
Added:
require "bundler/setup"
4
Added:
5
Added:
ARGV.unshift("--ensure-latest")
6
Added:
7
Added:
load Gem.bin_path("brakeman", "brakeman")
bin/dev
@@ -0,0 +1,2 @@
1
Added:
#!/usr/bin/env ruby
2
Added:
exec "./bin/rails", "server", *ARGV
bin/docker-entrypoint
@@ -0,0 +1,14 @@
1
Added:
#!/bin/bash -e
2
Added:
3
Added:
# Enable jemalloc for reduced memory usage and latency.
4
Added:
if [ -z "${LD_PRELOAD+x}" ]; then
5
Added:
LD_PRELOAD=$(find /usr/lib -name libjemalloc.so.2 -print -quit)
6
Added:
export LD_PRELOAD
7
Added:
fi
8
Added:
9
Added:
# If running the rails server then create or migrate existing database
10
Added:
if [ "${@: -2:1}" == "./bin/rails" ] && [ "${@: -1:1}" == "server" ]; then
11
Added:
./bin/rails db:prepare
12
Added:
fi
13
Added:
14
Added:
exec "${@}"
bin/importmap
@@ -0,0 +1,4 @@
1
Added:
#!/usr/bin/env ruby
2
Added:
3
Added:
require_relative "../config/application"
4
Added:
require "importmap/commands"
bin/rails
@@ -0,0 +1,4 @@
1
Added:
#!/usr/bin/env ruby
2
Added:
APP_PATH = File.expand_path("../config/application", __dir__)
3
Added:
require_relative "../config/boot"
4
Added:
require "rails/commands"
bin/rake
@@ -0,0 +1,4 @@
1
Added:
#!/usr/bin/env ruby
2
Added:
require_relative "../config/boot"
3
Added:
require "rake"
4
Added:
Rake.application.run
bin/rubocop
@@ -0,0 +1,8 @@
1
Added:
#!/usr/bin/env ruby
2
Added:
require "rubygems"
3
Added:
require "bundler/setup"
4
Added:
5
Added:
# explicit rubocop config increases performance slightly while avoiding config confusion.
6
Added:
ARGV.unshift("--config", File.expand_path("../.rubocop.yml", __dir__))
7
Added:
8
Added:
load Gem.bin_path("rubocop", "rubocop")
bin/setup
@@ -0,0 +1,34 @@
1
Added:
#!/usr/bin/env ruby
2
Added:
require "fileutils"
3
Added:
4
Added:
APP_ROOT = File.expand_path("..", __dir__)
5
Added:
6
Added:
def system!(*args)
7
Added:
system(*args, exception: true)
8
Added:
end
9
Added:
10
Added:
FileUtils.chdir APP_ROOT do
11
Added:
# This script is a way to set up or update your development environment automatically.
12
Added:
# This script is idempotent, so that you can run it at any time and get an expectable outcome.
13
Added:
# Add necessary setup steps to this file.
14
Added:
15
Added:
puts "== Installing dependencies =="
16
Added:
system("bundle check") || system!("bundle install")
17
Added:
18
Added:
# puts "\n== Copying sample files =="
19
Added:
# unless File.exist?("config/database.yml")
20
Added:
# FileUtils.cp "config/database.yml.sample", "config/database.yml"
21
Added:
# end
22
Added:
23
Added:
puts "\n== Preparing database =="
24
Added:
system! "bin/rails db:prepare"
25
Added:
26
Added:
puts "\n== Removing old logs and tempfiles =="
27
Added:
system! "bin/rails log:clear tmp:clear"
28
Added:
29
Added:
unless ARGV.include?("--skip-server")
30
Added:
puts "\n== Starting development server =="
31
Added:
STDOUT.flush # flush the output before exec(2) so that it displays
32
Added:
exec "bin/dev"
33
Added:
end
34
Added:
end
bin/thrust
@@ -0,0 +1,5 @@
1
Added:
#!/usr/bin/env ruby
2
Added:
require "rubygems"
3
Added:
require "bundler/setup"
4
Added:
5
Added:
load Gem.bin_path("thruster", "thrust")
config.ru
@@ -0,0 +1,6 @@
1
Added:
# This file is used by Rack-based servers to start the application.
2
Added:
3
Added:
require_relative "config/environment"
4
Added:
5
Added:
run Rails.application
6
Added:
Rails.application.load_server
config/application.rb
@@ -0,0 +1,27 @@
1
Added:
require_relative "boot"
2
Added:
3
Added:
require "rails/all"
4
Added:
5
Added:
# Require the gems listed in Gemfile, including any gems
6
Added:
# you've limited to :test, :development, or :production.
7
Added:
Bundler.require(*Rails.groups)
8
Added:
9
Added:
module Ferti
10
Added:
class Application < Rails::Application
11
Added:
# Initialize configuration defaults for originally generated Rails version.
12
Added:
config.load_defaults 8.0
13
Added:
14
Added:
# Please, add to the `ignore` list any other `lib` subdirectories that do
15
Added:
# not contain `.rb` files, or that should not be reloaded or eager loaded.
16
Added:
# Common ones are `templates`, `generators`, or `middleware`, for example.
17
Added:
config.autoload_lib(ignore: %w[assets tasks])
18
Added:
19
Added:
# Configuration for the application, engines, and railties goes here.
20
Added:
#
21
Added:
# These settings can be overridden in specific environments using the files
22
Added:
# in config/environments, which are processed later.
23
Added:
#
24
Added:
# config.time_zone = "Central Time (US & Canada)"
25
Added:
# config.eager_load_paths << Rails.root.join("extras")
26
Added:
end
27
Added:
end
config/boot.rb
@@ -0,0 +1,4 @@
1
Added:
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
2
Added:
3
Added:
require "bundler/setup" # Set up gems listed in the Gemfile.
4
Added:
require "bootsnap/setup" # Speed up boot time by caching expensive operations.
config/cable.yml
@@ -0,0 +1,10 @@
1
Added:
development:
2
Added:
adapter: async
3
Added:
4
Added:
test:
5
Added:
adapter: test
6
Added:
7
Added:
production:
8
Added:
adapter: redis
9
Added:
url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %>
10
Added:
channel_prefix: ferti_production
config/credentials.yml.enc
@@ -0,0 +1,1 @@
1
Added:
7jDV9/PMc5rXUDg80zXpTzhb856WzvtUFwrQT6hX6avsV6gfG2kbQZ6bw9dNhAuJG7biRAcqMMccziRtHW7xteFWXmlEdLEZVxyLJF1j692rThKblbhqwrl8A18Mtfo0urxfhwlvwpPlaML9RapsOtK4R4FrfOpRkxNRuJnvAzB+7ZTmB1fha+BhuDMJr4tz8EPC9F6S/rpR8k+jA4FSZDJnWjW1YzFK8A0YajIeGTWoQ09kTy2LmlZiR/7FpwfKEKaKaX+Mk1SmMRMQZhMpp6OM2CKRzy+dD9Rbv9HKa7LurLIqNOBSoh8CDqeMpquh299VaT6Gq3G4HXuUs6YH1hfWhOOFs0RZ91IJe83g9wYBUNVSjp/tkHo9E5IEorjvMcGRZUHuYqeFBgM1sS1uKXRKoBeI1UA+Nk72H5DRCP1VZuS0SvS4MGKtjzGJQVhyNGVXKAXt9xKQsSdoj0v1eJioHGKw0degKl/s/TbRXjE7QgPScBiBDkLe--ETBoZlP3MDy2hVMJ--xRfKKvHV54MospFJKlydjg==
config/database.yml
@@ -0,0 +1,41 @@
1
Added:
# SQLite. Versions 3.8.0 and up are supported.
2
Added:
# gem install sqlite3
3
Added:
#
4
Added:
# Ensure the SQLite 3 gem is defined in your Gemfile
5
Added:
# gem "sqlite3"
6
Added:
#
7
Added:
default: &default
8
Added:
adapter: sqlite3
9
Added:
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
10
Added:
timeout: 5000
11
Added:
12
Added:
development:
13
Added:
<<: *default
14
Added:
database: storage/development.sqlite3
15
Added:
16
Added:
# Warning: The database defined as "test" will be erased and
17
Added:
# re-generated from your development database when you run "rake".
18
Added:
# Do not set this db to the same as development or production.
19
Added:
test:
20
Added:
<<: *default
21
Added:
database: storage/test.sqlite3
22
Added:
23
Added:
24
Added:
# Store production database in the storage/ directory, which by default
25
Added:
# is mounted as a persistent Docker volume in config/deploy.yml.
26
Added:
production:
27
Added:
primary:
28
Added:
<<: *default
29
Added:
database: storage/production.sqlite3
30
Added:
cache:
31
Added:
<<: *default
32
Added:
database: storage/production_cache.sqlite3
33
Added:
migrations_paths: db/cache_migrate
34
Added:
queue:
35
Added:
<<: *default
36
Added:
database: storage/production_queue.sqlite3
37
Added:
migrations_paths: db/queue_migrate
38
Added:
cable:
39
Added:
<<: *default
40
Added:
database: storage/production_cable.sqlite3
41
Added:
migrations_paths: db/cable_migrate
config/deploy.yml
@@ -0,0 +1,116 @@
1
Added:
# Name of your application. Used to uniquely configure containers.
2
Added:
service: ferti
3
Added:
4
Added:
# Name of the container image.
5
Added:
image: your-user/ferti
6
Added:
7
Added:
# Deploy to these servers.
8
Added:
servers:
9
Added:
web:
10
Added:
- 192.168.0.1
11
Added:
# job:
12
Added:
# hosts:
13
Added:
# - 192.168.0.1
14
Added:
# cmd: bin/jobs
15
Added:
16
Added:
# Enable SSL auto certification via Let's Encrypt and allow for multiple apps on a single web server.
17
Added:
# Remove this section when using multiple web servers and ensure you terminate SSL at your load balancer.
18
Added:
#
19
Added:
# Note: If using Cloudflare, set encryption mode in SSL/TLS setting to "Full" to enable CF-to-app encryption.
20
Added:
proxy:
21
Added:
ssl: true
22
Added:
host: app.example.com
23
Added:
24
Added:
# Credentials for your image host.
25
Added:
registry:
26
Added:
# Specify the registry server, if you're not using Docker Hub
27
Added:
# server: registry.digitalocean.com / ghcr.io / ...
28
Added:
username: your-user
29
Added:
30
Added:
# Always use an access token rather than real password when possible.
31
Added:
password:
32
Added:
- KAMAL_REGISTRY_PASSWORD
33
Added:
34
Added:
# Inject ENV variables into containers (secrets come from .kamal/secrets).
35
Added:
env:
36
Added:
secret:
37
Added:
- RAILS_MASTER_KEY
38
Added:
clear:
39
Added:
# Run the Solid Queue Supervisor inside the web server's Puma process to do jobs.
40
Added:
# When you start using multiple servers, you should split out job processing to a dedicated machine.
41
Added:
SOLID_QUEUE_IN_PUMA: true
42
Added:
43
Added:
# Set number of processes dedicated to Solid Queue (default: 1)
44
Added:
# JOB_CONCURRENCY: 3
45
Added:
46
Added:
# Set number of cores available to the application on each server (default: 1).
47
Added:
# WEB_CONCURRENCY: 2
48
Added:
49
Added:
# Match this to any external database server to configure Active Record correctly
50
Added:
# Use ferti-db for a db accessory server on same machine via local kamal docker network.
51
Added:
# DB_HOST: 192.168.0.2
52
Added:
53
Added:
# Log everything from Rails
54
Added:
# RAILS_LOG_LEVEL: debug
55
Added:
56
Added:
# Aliases are triggered with "bin/kamal <alias>". You can overwrite arguments on invocation:
57
Added:
# "bin/kamal logs -r job" will tail logs from the first server in the job section.
58
Added:
aliases:
59
Added:
console: app exec --interactive --reuse "bin/rails console"
60
Added:
shell: app exec --interactive --reuse "bash"
61
Added:
logs: app logs -f
62
Added:
dbc: app exec --interactive --reuse "bin/rails dbconsole"
63
Added:
64
Added:
65
Added:
# Use a persistent storage volume for sqlite database files and local Active Storage files.
66
Added:
# Recommended to change this to a mounted volume path that is backed up off server.
67
Added:
volumes:
68
Added:
- "ferti_storage:/rails/storage"
69
Added:
70
Added:
71
Added:
# Bridge fingerprinted assets, like JS and CSS, between versions to avoid
72
Added:
# hitting 404 on in-flight requests. Combines all files from new and old
73
Added:
# version inside the asset_path.
74
Added:
asset_path: /rails/public/assets
75
Added:
76
Added:
# Configure the image builder.
77
Added:
builder:
78
Added:
arch: amd64
79
Added:
80
Added:
# # Build image via remote server (useful for faster amd64 builds on arm64 computers)
81
Added:
# remote: ssh://docker@docker-builder-server
82
Added:
#
83
Added:
# # Pass arguments and secrets to the Docker build process
84
Added:
# args:
85
Added:
# RUBY_VERSION: ruby-3.2.8
86
Added:
# secrets:
87
Added:
# - GITHUB_TOKEN
88
Added:
# - RAILS_MASTER_KEY
89
Added:
90
Added:
# Use a different ssh user than root
91
Added:
# ssh:
92
Added:
# user: app
93
Added:
94
Added:
# Use accessory services (secrets come from .kamal/secrets).
95
Added:
# accessories:
96
Added:
# db:
97
Added:
# image: mysql:8.0
98
Added:
# host: 192.168.0.2
99
Added:
# # Change to 3306 to expose port to the world instead of just local network.
100
Added:
# port: "127.0.0.1:3306:3306"
101
Added:
# env:
102
Added:
# clear:
103
Added:
# MYSQL_ROOT_HOST: '%'
104
Added:
# secret:
105
Added:
# - MYSQL_ROOT_PASSWORD
106
Added:
# files:
107
Added:
# - config/mysql/production.cnf:/etc/mysql/my.cnf
108
Added:
# - db/production.sql:/docker-entrypoint-initdb.d/setup.sql
109
Added:
# directories:
110
Added:
# - data:/var/lib/mysql
111
Added:
# redis:
112
Added:
# image: redis:7.0
113
Added:
# host: 192.168.0.2
114
Added:
# port: 6379
115
Added:
# directories:
116
Added:
# - data:/data
config/environment.rb
@@ -0,0 +1,5 @@
1
Added:
# Load the Rails application.
2
Added:
require_relative "application"
3
Added:
4
Added:
# Initialize the Rails application.
5
Added:
Rails.application.initialize!
config/environments/development.rb
@@ -0,0 +1,72 @@
1
Added:
require "active_support/core_ext/integer/time"
2
Added:
3
Added:
Rails.application.configure do
4
Added:
# Settings specified here will take precedence over those in config/application.rb.
5
Added:
6
Added:
# Make code changes take effect immediately without server restart.
7
Added:
config.enable_reloading = true
8
Added:
9
Added:
# Do not eager load code on boot.
10
Added:
config.eager_load = false
11
Added:
12
Added:
# Show full error reports.
13
Added:
config.consider_all_requests_local = true
14
Added:
15
Added:
# Enable server timing.
16
Added:
config.server_timing = true
17
Added:
18
Added:
# Enable/disable Action Controller caching. By default Action Controller caching is disabled.
19
Added:
# Run rails dev:cache to toggle Action Controller caching.
20
Added:
if Rails.root.join("tmp/caching-dev.txt").exist?
21
Added:
config.action_controller.perform_caching = true
22
Added:
config.action_controller.enable_fragment_cache_logging = true
23
Added:
config.public_file_server.headers = { "cache-control" => "public, max-age=#{2.days.to_i}" }
24
Added:
else
25
Added:
config.action_controller.perform_caching = false
26
Added:
end
27
Added:
28
Added:
# Change to :null_store to avoid any caching.
29
Added:
config.cache_store = :memory_store
30
Added:
31
Added:
# Store uploaded files on the local file system (see config/storage.yml for options).
32
Added:
config.active_storage.service = :local
33
Added:
34
Added:
# Don't care if the mailer can't send.
35
Added:
config.action_mailer.raise_delivery_errors = false
36
Added:
37
Added:
# Make template changes take effect immediately.
38
Added:
config.action_mailer.perform_caching = false
39
Added:
40
Added:
# Set localhost to be used by links generated in mailer templates.
41
Added:
config.action_mailer.default_url_options = { host: "localhost", port: 3000 }
42
Added:
43
Added:
# Print deprecation notices to the Rails logger.
44
Added:
config.active_support.deprecation = :log
45
Added:
46
Added:
# Raise an error on page load if there are pending migrations.
47
Added:
config.active_record.migration_error = :page_load
48
Added:
49
Added:
# Highlight code that triggered database queries in logs.
50
Added:
config.active_record.verbose_query_logs = true
51
Added:
52
Added:
# Append comments with runtime information tags to SQL queries in logs.
53
Added:
config.active_record.query_log_tags_enabled = true
54
Added:
55
Added:
# Highlight code that enqueued background job in logs.
56
Added:
config.active_job.verbose_enqueue_logs = true
57
Added:
58
Added:
# Raises error for missing translations.
59
Added:
# config.i18n.raise_on_missing_translations = true
60
Added:
61
Added:
# Annotate rendered view with file names.
62
Added:
config.action_view.annotate_rendered_view_with_filenames = true
63
Added:
64
Added:
# Uncomment if you wish to allow Action Cable access from any origin.
65
Added:
# config.action_cable.disable_request_forgery_protection = true
66
Added:
67
Added:
# Raise error when a before_action's only/except options reference missing actions.
68
Added:
config.action_controller.raise_on_missing_callback_actions = true
69
Added:
70
Added:
# Apply autocorrection by RuboCop to files generated by `bin/rails generate`.
71
Added:
# config.generators.apply_rubocop_autocorrect_after_generate!
72
Added:
end
config/environments/production.rb
@@ -0,0 +1,89 @@
1
Added:
require "active_support/core_ext/integer/time"
2
Added:
3
Added:
Rails.application.configure do
4
Added:
# Settings specified here will take precedence over those in config/application.rb.
5
Added:
6
Added:
# Code is not reloaded between requests.
7
Added:
config.enable_reloading = false
8
Added:
9
Added:
# Eager load code on boot for better performance and memory savings (ignored by Rake tasks).
10
Added:
config.eager_load = true
11
Added:
12
Added:
# Full error reports are disabled.
13
Added:
config.consider_all_requests_local = false
14
Added:
15
Added:
# Turn on fragment caching in view templates.
16
Added:
config.action_controller.perform_caching = true
17
Added:
18
Added:
# Cache assets for far-future expiry since they are all digest stamped.
19
Added:
config.public_file_server.headers = { "cache-control" => "public, max-age=#{1.year.to_i}" }
20
Added:
21
Added:
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
22
Added:
# config.asset_host = "http://assets.example.com"
23
Added:
24
Added:
# Store uploaded files on the local file system (see config/storage.yml for options).
25
Added:
config.active_storage.service = :local
26
Added:
27
Added:
# Assume all access to the app is happening through a SSL-terminating reverse proxy.
28
Added:
config.assume_ssl = true
29
Added:
30
Added:
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
31
Added:
config.force_ssl = true
32
Added:
33
Added:
# Skip http-to-https redirect for the default health check endpoint.
34
Added:
# config.ssl_options = { redirect: { exclude: ->(request) { request.path == "/up" } } }
35
Added:
36
Added:
# Log to STDOUT with the current request id as a default log tag.
37
Added:
config.log_tags = [ :request_id ]
38
Added:
config.logger = ActiveSupport::TaggedLogging.logger(STDOUT)
39
Added:
40
Added:
# Change to "debug" to log everything (including potentially personally-identifiable information!)
41
Added:
config.log_level = ENV.fetch("RAILS_LOG_LEVEL", "info")
42
Added:
43
Added:
# Prevent health checks from clogging up the logs.
44
Added:
config.silence_healthcheck_path = "/up"
45
Added:
46
Added:
# Don't log any deprecations.
47
Added:
config.active_support.report_deprecations = false
48
Added:
49
Added:
# Replace the default in-process memory cache store with a durable alternative.
50
Added:
# config.cache_store = :mem_cache_store
51
Added:
52
Added:
# Replace the default in-process and non-durable queuing backend for Active Job.
53
Added:
# config.active_job.queue_adapter = :resque
54
Added:
55
Added:
# Ignore bad email addresses and do not raise email delivery errors.
56
Added:
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
57
Added:
# config.action_mailer.raise_delivery_errors = false
58
Added:
59
Added:
# Set host to be used by links generated in mailer templates.
60
Added:
config.action_mailer.default_url_options = { host: "example.com" }
61
Added:
62
Added:
# Specify outgoing SMTP server. Remember to add smtp/* credentials via rails credentials:edit.
63
Added:
# config.action_mailer.smtp_settings = {
64
Added:
# user_name: Rails.application.credentials.dig(:smtp, :user_name),
65
Added:
# password: Rails.application.credentials.dig(:smtp, :password),
66
Added:
# address: "smtp.example.com",
67
Added:
# port: 587,
68
Added:
# authentication: :plain
69
Added:
# }
70
Added:
71
Added:
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
72
Added:
# the I18n.default_locale when a translation cannot be found).
73
Added:
config.i18n.fallbacks = true
74
Added:
75
Added:
# Do not dump schema after migrations.
76
Added:
config.active_record.dump_schema_after_migration = false
77
Added:
78
Added:
# Only use :id for inspections in production.
79
Added:
config.active_record.attributes_for_inspect = [ :id ]
80
Added:
81
Added:
# Enable DNS rebinding protection and other `Host` header attacks.
82
Added:
# config.hosts = [
83
Added:
# "example.com", # Allow requests from example.com
84
Added:
# /.*\.example\.com/ # Allow requests from subdomains like `www.example.com`
85
Added:
# ]
86
Added:
#
87
Added:
# Skip DNS rebinding protection for the default health check endpoint.
88
Added:
# config.host_authorization = { exclude: ->(request) { request.path == "/up" } }
89
Added:
end
config/environments/test.rb
@@ -0,0 +1,53 @@
1
Added:
# The test environment is used exclusively to run your application's
2
Added:
# test suite. You never need to work with it otherwise. Remember that
3
Added:
# your test database is "scratch space" for the test suite and is wiped
4
Added:
# and recreated between test runs. Don't rely on the data there!
5
Added:
6
Added:
Rails.application.configure do
7
Added:
# Settings specified here will take precedence over those in config/application.rb.
8
Added:
9
Added:
# While tests run files are not watched, reloading is not necessary.
10
Added:
config.enable_reloading = false
11
Added:
12
Added:
# Eager loading loads your entire application. When running a single test locally,
13
Added:
# this is usually not necessary, and can slow down your test suite. However, it's
14
Added:
# recommended that you enable it in continuous integration systems to ensure eager
15
Added:
# loading is working properly before deploying your code.
16
Added:
config.eager_load = ENV["CI"].present?
17
Added:
18
Added:
# Configure public file server for tests with cache-control for performance.
19
Added:
config.public_file_server.headers = { "cache-control" => "public, max-age=3600" }
20
Added:
21
Added:
# Show full error reports.
22
Added:
config.consider_all_requests_local = true
23
Added:
config.cache_store = :null_store
24
Added:
25
Added:
# Render exception templates for rescuable exceptions and raise for other exceptions.
26
Added:
config.action_dispatch.show_exceptions = :rescuable
27
Added:
28
Added:
# Disable request forgery protection in test environment.
29
Added:
config.action_controller.allow_forgery_protection = false
30
Added:
31
Added:
# Store uploaded files on the local file system in a temporary directory.
32
Added:
config.active_storage.service = :test
33
Added:
34
Added:
# Tell Action Mailer not to deliver emails to the real world.
35
Added:
# The :test delivery method accumulates sent emails in the
36
Added:
# ActionMailer::Base.deliveries array.
37
Added:
config.action_mailer.delivery_method = :test
38
Added:
39
Added:
# Set host to be used by links generated in mailer templates.
40
Added:
config.action_mailer.default_url_options = { host: "example.com" }
41
Added:
42
Added:
# Print deprecation notices to the stderr.
43
Added:
config.active_support.deprecation = :stderr
44
Added:
45
Added:
# Raises error for missing translations.
46
Added:
# config.i18n.raise_on_missing_translations = true
47
Added:
48
Added:
# Annotate rendered view with file names.
49
Added:
# config.action_view.annotate_rendered_view_with_filenames = true
50
Added:
51
Added:
# Raise error when a before_action's only/except options reference missing actions.
52
Added:
config.action_controller.raise_on_missing_callback_actions = true
53
Added:
end
config/importmap.rb
@@ -0,0 +1,3 @@
1
Added:
# Pin npm packages by running ./bin/importmap
2
Added:
3
Added:
pin "application"
config/initializers/assets.rb
@@ -0,0 +1,7 @@
1
Added:
# Be sure to restart your server when you modify this file.
2
Added:
3
Added:
# Version of your assets, change this if you want to expire all your assets.
4
Added:
Rails.application.config.assets.version = "1.0"
5
Added:
6
Added:
# Add additional assets to the asset load path.
7
Added:
# Rails.application.config.assets.paths << Emoji.images_path
config/initializers/content_security_policy.rb
@@ -0,0 +1,25 @@
1
Added:
# Be sure to restart your server when you modify this file.
2
Added:
3
Added:
# Define an application-wide content security policy.
4
Added:
# See the Securing Rails Applications Guide for more information:
5
Added:
# https://guides.rubyonrails.org/security.html#content-security-policy-header
6
Added:
7
Added:
# Rails.application.configure do
8
Added:
# config.content_security_policy do |policy|
9
Added:
# policy.default_src :self, :https
10
Added:
# policy.font_src :self, :https, :data
11
Added:
# policy.img_src :self, :https, :data
12
Added:
# policy.object_src :none
13
Added:
# policy.script_src :self, :https
14
Added:
# policy.style_src :self, :https
15
Added:
# # Specify URI for violation reports
16
Added:
# # policy.report_uri "/csp-violation-report-endpoint"
17
Added:
# end
18
Added:
#
19
Added:
# # Generate session nonces for permitted importmap, inline scripts, and inline styles.
20
Added:
# config.content_security_policy_nonce_generator = ->(request) { request.session.id.to_s }
21
Added:
# config.content_security_policy_nonce_directives = %w(script-src style-src)
22
Added:
#
23
Added:
# # Report violations without enforcing the policy.
24
Added:
# # config.content_security_policy_report_only = true
25
Added:
# end
config/initializers/filter_parameter_logging.rb
@@ -0,0 +1,8 @@
1
Added:
# Be sure to restart your server when you modify this file.
2
Added:
3
Added:
# Configure parameters to be partially matched (e.g. passw matches password) and filtered from the log file.
4
Added:
# Use this to limit dissemination of sensitive information.
5
Added:
# See the ActiveSupport::ParameterFilter documentation for supported notations and behaviors.
6
Added:
Rails.application.config.filter_parameters += [
7
Added:
:passw, :email, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn, :cvv, :cvc
8
Added:
]
config/initializers/inflections.rb
@@ -0,0 +1,16 @@
1
Added:
# Be sure to restart your server when you modify this file.
2
Added:
3
Added:
# Add new inflection rules using the following format. Inflections
4
Added:
# are locale specific, and you may define rules for as many different
5
Added:
# locales as you wish. All of these examples are active by default:
6
Added:
# ActiveSupport::Inflector.inflections(:en) do |inflect|
7
Added:
# inflect.plural /^(ox)$/i, "\\1en"
8
Added:
# inflect.singular /^(ox)en/i, "\\1"
9
Added:
# inflect.irregular "person", "people"
10
Added:
# inflect.uncountable %w( fish sheep )
11
Added:
# end
12
Added:
13
Added:
# These inflection rules are supported but not enabled by default:
14
Added:
# ActiveSupport::Inflector.inflections(:en) do |inflect|
15
Added:
# inflect.acronym "RESTful"
16
Added:
# end
config/locales/en.yml
@@ -0,0 +1,31 @@
1
Added:
# Files in the config/locales directory are used for internationalization and
2
Added:
# are automatically loaded by Rails. If you want to use locales other than
3
Added:
# English, add the necessary files in this directory.
4
Added:
#
5
Added:
# To use the locales, use `I18n.t`:
6
Added:
#
7
Added:
# I18n.t "hello"
8
Added:
#
9
Added:
# In views, this is aliased to just `t`:
10
Added:
#
11
Added:
# <%= t("hello") %>
12
Added:
#
13
Added:
# To use a different locale, set it with `I18n.locale`:
14
Added:
#
15
Added:
# I18n.locale = :es
16
Added:
#
17
Added:
# This would use the information in config/locales/es.yml.
18
Added:
#
19
Added:
# To learn more about the API, please read the Rails Internationalization guide
20
Added:
# at https://guides.rubyonrails.org/i18n.html.
21
Added:
#
22
Added:
# Be aware that YAML interprets the following case-insensitive strings as
23
Added:
# booleans: `true`, `false`, `on`, `off`, `yes`, `no`. Therefore, these strings
24
Added:
# must be quoted to be interpreted as strings. For example:
25
Added:
#
26
Added:
# en:
27
Added:
# "yes": yup
28
Added:
# enabled: "ON"
29
Added:
30
Added:
en:
31
Added:
hello: "Hello world"
config/puma.rb
@@ -0,0 +1,41 @@
1
Added:
# This configuration file will be evaluated by Puma. The top-level methods that
2
Added:
# are invoked here are part of Puma's configuration DSL. For more information
3
Added:
# about methods provided by the DSL, see https://puma.io/puma/Puma/DSL.html.
4
Added:
#
5
Added:
# Puma starts a configurable number of processes (workers) and each process
6
Added:
# serves each request in a thread from an internal thread pool.
7
Added:
#
8
Added:
# You can control the number of workers using ENV["WEB_CONCURRENCY"]. You
9
Added:
# should only set this value when you want to run 2 or more workers. The
10
Added:
# default is already 1.
11
Added:
#
12
Added:
# The ideal number of threads per worker depends both on how much time the
13
Added:
# application spends waiting for IO operations and on how much you wish to
14
Added:
# prioritize throughput over latency.
15
Added:
#
16
Added:
# As a rule of thumb, increasing the number of threads will increase how much
17
Added:
# traffic a given process can handle (throughput), but due to CRuby's
18
Added:
# Global VM Lock (GVL) it has diminishing returns and will degrade the
19
Added:
# response time (latency) of the application.
20
Added:
#
21
Added:
# The default is set to 3 threads as it's deemed a decent compromise between
22
Added:
# throughput and latency for the average Rails application.
23
Added:
#
24
Added:
# Any libraries that use a connection pool or another resource pool should
25
Added:
# be configured to provide at least as many connections as the number of
26
Added:
# threads. This includes Active Record's `pool` parameter in `database.yml`.
27
Added:
threads_count = ENV.fetch("RAILS_MAX_THREADS", 3)
28
Added:
threads threads_count, threads_count
29
Added:
30
Added:
# Specifies the `port` that Puma will listen on to receive requests; default is 3000.
31
Added:
port ENV.fetch("PORT", 3000)
32
Added:
33
Added:
# Allow puma to be restarted by `bin/rails restart` command.
34
Added:
plugin :tmp_restart
35
Added:
36
Added:
# Run the Solid Queue supervisor inside of Puma for single-server deployments
37
Added:
plugin :solid_queue if ENV["SOLID_QUEUE_IN_PUMA"]
38
Added:
39
Added:
# Specify the PID file. Defaults to tmp/pids/server.pid in development.
40
Added:
# In other environments, only set the PID file if requested.
41
Added:
pidfile ENV["PIDFILE"] if ENV["PIDFILE"]
config/routes.rb
@@ -0,0 +1,32 @@
1
Added:
Rails.application.routes.draw do
2
Added:
root "dashboard#index"
3
Added:
4
Added:
get "ferti_recipe", to: "recipes#show"
5
Added:
resources :fertilizer_products
6
Added:
resources :raft_crops, only: [ :update ]
7
Added:
resources :rafts, only: [ :index ] do
8
Added:
collection do
9
Added:
get :editor # rafts/editor
10
Added:
patch :assign_all # bulk assign all rafts
11
Added:
patch :assign_bed # bulk assign per bed
12
Added:
end
13
Added:
member do
14
Added:
patch :assign_one # per raft
15
Added:
end
16
Added:
end
17
Added:
resources :crops
18
Added:
resources :nutrient_measurements
19
Added:
20
Added:
# Define your application routes per the DSL in https://guides.rubyonrails.org/routing.html
21
Added:
22
Added:
# Reveal health status on /up that returns 200 if the app boots with no exceptions, otherwise 500.
23
Added:
# Can be used by load balancers and uptime monitors to verify that the app is live.
24
Added:
get "up" => "rails/health#show", as: :rails_health_check
25
Added:
26
Added:
# Render dynamic PWA files from app/views/pwa/* (remember to link manifest in application.html.erb)
27
Added:
# get "manifest" => "rails/pwa#manifest", as: :pwa_manifest
28
Added:
# get "service-worker" => "rails/pwa#service_worker", as: :pwa_service_worker
29
Added:
30
Added:
# Defines the root path route ("/")
31
Added:
# root "posts#index"
32
Added:
end
config/storage.yml
@@ -0,0 +1,34 @@
1
Added:
test:
2
Added:
service: Disk
3
Added:
root: <%= Rails.root.join("tmp/storage") %>
4
Added:
5
Added:
local:
6
Added:
service: Disk
7
Added:
root: <%= Rails.root.join("storage") %>
8
Added:
9
Added:
# Use bin/rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key)
10
Added:
# amazon:
11
Added:
# service: S3
12
Added:
# access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %>
13
Added:
# secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %>
14
Added:
# region: us-east-1
15
Added:
# bucket: your_own_bucket-<%= Rails.env %>
16
Added:
17
Added:
# Remember not to checkin your GCS keyfile to a repository
18
Added:
# google:
19
Added:
# service: GCS
20
Added:
# project: your_project
21
Added:
# credentials: <%= Rails.root.join("path/to/gcs.keyfile") %>
22
Added:
# bucket: your_own_bucket-<%= Rails.env %>
23
Added:
24
Added:
# Use bin/rails credentials:edit to set the Azure Storage secret (as azure_storage:storage_access_key)
25
Added:
# microsoft:
26
Added:
# service: AzureStorage
27
Added:
# storage_account_name: your_account_name
28
Added:
# storage_access_key: <%= Rails.application.credentials.dig(:azure_storage, :storage_access_key) %>
29
Added:
# container: your_container_name-<%= Rails.env %>
30
Added:
31
Added:
# mirror:
32
Added:
# service: Mirror
33
Added:
# primary: local
34
Added:
# mirrors: [ amazon, google, microsoft ]
db/data/dolibarr_measurements.csv
@@ -0,0 +1,44 @@
1
Added:
date,nno3,p,k,ca,mg,s,na,cl,si,fe,zn,b,mn,cu,mo,nnh4
2
Added:
08/05/2021,1.87,0.0031936,0.91,100.79,8.37,1.08666558,6.73,12.28,5.42,0.01,0.01,0.01,0.01,0.01,0.01,0.02
3
Added:
02/07/2021,66.3,0.0095808,110.91,93.09,17.95,32.84663382,10.27,18.53,5.02,4.37,0.03,0.18,0.15,0,0,0.63
4
Added:
12/07/2021,61.66,2.011968,122.53,73.5,17.44,47.64328569,0.45,0.82,0.36,1.76,0.05,0.13,0.32,0,0,0
5
Added:
12/08/2021,67.27,0.351296,94.45,89.48,16.25,9.11665755,10.76,16.51,4.95,3.2,0.03,0.14,0.07,0,0,0.06
6
Added:
06/09/2021,77.8,7.1153408,96.29,86.31,14.21,23.90664276,9.32,14.92,4.61,2.45,0.08,0.12,0.05,0.03,0,0.02
7
Added:
21/09/2021,87.88,11.33728,117.24,90.64,17.25,29.90663676,9.92,15.96,4.68,2.4,0.08,0.27,0.12,0.04,0.01,0.02
8
Added:
19/10/2021,77.84,13.4195072,121.91,94.71,18.3,33.19663347,12.36,15.28,4.47,2.72,0.11,0.74,0.04,0.04,0.02,0.03
9
Added:
01/12/2021,57.09,6.6842048,81.46,61.45,10.52,17.72331561,17.36,23.05,2.11,1.27,0.17,0.32,0.01,0.03,0.02,0.07
10
Added:
04/02/2022,43.56,6.5979776,63.1,63.72,9.92,17.3999826,17.08,21.15,1.44,1.6,0.22,0.34,0.01,0.04,0.01,0.03
11
Added:
12/04/2022,38.36,6.5021696,83.48,49.75,6.42,14.14331919,29.8,38.85,0.23,0.3,0.2,0,0.02,0.01,0.4,0.07
12
Added:
16/05/2022,24.63,0.542912,30.22,39.79,6.75,0.0666666,25.98,25.89,0.14,1.13,0.3,0.23,0.01,0.02,0.005,0.12
13
Added:
15/06/2022,2.45,0.0606784,0.69,24.58,4.14,1.24999875,19.59,11.33,0.32,0.79,0.25,0.13,0.01,0.02,0.01,0.1
14
Added:
04/07/2022,24.3,3.081824,42.34,39.79,8.09,0.41333292,19.79,11.32,1.24,0.7,0.18,0.07,0.02,0.01,0.005,0.68
15
Added:
01/08/2022,4.88,0.2299392,27.77,22.48,6.71,18.68331465,23,5,0.64,0.97,0.17,0.04,0.005,0.005,0.005,0.07
16
Added:
07/09/2022,29.28,2.07584,79.65,36.05,13.82,31.17663549,33.41,12.32,0.83,0.84,0.13,0.07,0.01,0.005,0.005,0.8
17
Added:
24/10/2022,41.61,1.2646656,68.38,47.44,11.54,21.55664511,28.22,18.73,0.81,0.41,0.1,0.05,0.005,0.005,0.005,0.09
18
Added:
21/11/2022,40.34,3.1105664,53.6,51.09,9.69,17.97331536,25.5,18.85,0.97,0.58,0.11,0.07,0.005,0.005,0.005,0.04
19
Added:
09/01/2023,48.71,6.6171392,63.08,71.45,11.58,6.55666011,23.81,21.32,1.46,1.04,0.13,0.13,0.01,0.01,0.01,0.03
20
Added:
21/02/2023,56.03,7.5273152,53.3,81.75,12.11,19.31998068,23.16,27.27,1.86,0.95,0.18,0.19,0.01,0.005,0.02,0.13
21
Added:
20/04/2023,50.67,7.0546624,76.45,76.63,10.57,15.54331779,22.25,26.97,0.95,0.96,0.19,0.12,0.005,0.005,0.005,0.21
22
Added:
07/06/2023,48.82,7.3005696,90.04,64.58,9.96,16.92664974,22.39,25.93,0.78,0.42,0.2,0.11,0.005,0.005,0.005,0.16
23
Added:
13/07/2023,21.79,1.5712512,77.61,40.41,9.74,20.82331251,26.23,22.49,0.6,1.16,0.22,0.31,0,0,0.02,0.14
24
Added:
17/07/2023,21.79,4.9213376,77.61,40.41,9.74,20.82331251,26.23,22.49,0.6,1.16,0.22,0.31,0.01,0.01,0.02,0.14
25
Added:
23/08/2023,23.88,2.778432,97.75,49.74,26.25,31.24996875,31.11,16.43,1.33,0.8,0.18,0.14,0,0,0.01,1.01
26
Added:
02/09/2023,23.88,2.778432,97.75,49.74,16.15,31.24996875,31.11,16.43,1.33,0.8,0.18,0.14,0,0,0.01,1.01
27
Added:
13/10/2023,71.9,5.0905984,106.35,91.03,18.11,34.90663176,32.36,14.59,1.43,0.97,0.17,0.05,0,0,0,0.24
28
Added:
28/12/2023,70.58,9.1368896,141.05,68.18,11.96,24.18664248,27.95,21.57,1.31,0.88,0.16,0.15,0,0,0.02,0.06
29
Added:
16/01/2024,77.26,11.433088,149.17,68.71,12.14,23.24331009,29.88,27.04,1.15,1.14,0.26,0.14,0,0,0,0.09
30
Added:
04/03/2024,84.65,13.4418624,185.21,66.05,15.61,30.69330264,40.12,36.82,0.66,0.93,0.39,0.35,0,0,0.03,0.16
31
Added:
23/04/2024,69.17,11.2350848,116.41,52.96,14.07,28.95330438,80.73,37.54,0.57,0.79,0.42,0.38,0.01,0,0.03,0.16
32
Added:
30/05/2024,46.74,7.520928,81.84,38.61,10.48,26.52997347,79.96,40.47,0.34,0.87,0.45,0.37,0,0.03,0.03,0.12
33
Added:
05/07/2024,27.51,3.960064,75.58,27.78,8.29,25.99330734,92.2,44.74,0.32,0.59,0.45,0.37,0,0.03,0.03,0.15
34
Added:
23/07/2024,16.55,2.4143616,83.62,16.52,4.9,20.45997954,79.04,40.51,0.32,0.77,0.43,0.26,0,0.03,0.02,0.43
35
Added:
06/08/2024,0,0.3001984,74.41,6.82,2.56,17.28664938,78.79,35.04,0.42,0.9,0.37,0.29,0,0.03,0.02,0.13
36
Added:
09/09/2024,18.3,2.87424,85.3,8.7,1.7,10.5666561,53.7,22.7,2.5,0.7,0.2,0.1,0,0,0,0
37
Added:
01/10/2024,22.94,4.1740352,112.46,9.44,2,13.51998648,58.57,28.76,0.27,0.6,0.26,0.17,0,0.02,0,0.2
38
Added:
22/11/2024,66,2.87424,127,33,9,7.333326,63,40,2.8,0.73,0.37,0.16,0.01,0.01,0.01,0
39
Added:
20/01/2025,94.26,15.664608,146.27,76.06,14.24,32.05663461,64.29,46.99,0.45,0.37,0.48,0.16,0.08,0.03,0.01,0.11
40
Added:
06/03/2025,95.82,20.007904,171.83,92.24,15.75,35.2332981,82.27,54.5,0.45,0.17,0.49,0.16,0.03,0.02,0,0.06
41
Added:
04/04/2025,85.49,17.2646016,109.91,88.54,13.47,31.08663558,65.02,53.96,0.28,0.65,0.51,0.13,0.01,0.01,0,0
42
Added:
22/05/2025,49.8,9.9927744,92.41,61.42,8.47,22.42331091,52.95,38.25,0.32,0.86,0.48,0.23,0.03,0,0.02,0.13
43
Added:
11/06/2025,30.28,5.700576,50.2,48.96,5.73,22.10664456,51.34,33.41,0,0.96,0.51,0.26,0,0,0,0
44
Added:
01/08/2025,1.34,0.4854272,77.64,16.45,5.52,22.93997706,58.45,25.83,0.5,0.48,0.44,0.17,0,0,0,0
db/data/nutrient_requirements.csv
@@ -0,0 +1,9 @@
1
Added:
Nom,NNO3,P,K,Ca,Mg,S,Na,Cl,Si,Fe,Zn,B,Mn,Cu,Mo,NNH4
2
Added:
Générique croissance,160,30,230,100,30,60,0,0,0,5,"0,15","0,3","0,5","0,15","0,05",0
3
Added:
Générique floraison,130,60,300,100,30,60,0,0,0,2,"0,1","0,5","0,5","0,05","0,05",0
4
Added:
Laitue,190,50,210,200,50,66,0,0,0,5,"0,15","0,3","0,5","0,15","0,05",0
5
Added:
Tomate (cycle entier),140,50,352,180,50,168,0,0,0,5,"0,1","0,3","0,8","0,07","0,03",0
6
Added:
Tomate 10-14 jours,100,40,200,100,20,53,0,0,0,3,"0,1","0,3","0,8","0,07","0,03",0
7
Added:
Tomate 1ere grappe,130,55,300,150,33,109,0,0,0,3,"0,1","0,3","0,8","0,07","0,03",0
8
Added:
Tomate à maturité,180,65,400,400,45,144,0,0,0,3,"0,1","0,3","0,8","0,07","0,03",0
9
Added:
Framboise - tous stades,70,12,88,90,24,48,0,0,50,0.56,"0,325",11,"0,11","0,032","0,01",0
db/migrate/20250820175727_create_nutrients.rb
@@ -0,0 +1,10 @@
1
Added:
class CreateNutrients < ActiveRecord::Migration[8.0]
2
Added:
def change
3
Added:
create_table :nutrients do |t|
4
Added:
t.string :formula
5
Added:
t.string :name
6
Added:
7
Added:
t.timestamps
8
Added:
end
9
Added:
end
10
Added:
end
db/migrate/20250820175742_create_nutrient_measurements.rb
@@ -0,0 +1,27 @@
1
Added:
class CreateNutrientMeasurements < ActiveRecord::Migration[8.0]
2
Added:
def change
3
Added:
create_table :nutrient_measurements do |t|
4
Added:
t.date :measured_on
5
Added:
t.float :nno3
6
Added:
t.float :p
7
Added:
t.float :k
8
Added:
t.float :ca
9
Added:
t.float :mg
10
Added:
t.float :s
11
Added:
t.float :na
12
Added:
t.float :cl
13
Added:
t.float :si
14
Added:
t.float :fe
15
Added:
t.float :zn
16
Added:
t.float :b
17
Added:
t.float :mn
18
Added:
t.float :cu
19
Added:
t.float :mo
20
Added:
t.float :nnh4
21
Added:
22
Added:
t.timestamps
23
Added:
end
24
Added:
25
Added:
add_index :nutrient_measurements, :measured_on, unique: true
26
Added:
end
27
Added:
end
db/migrate/20250823140019_create_crops.rb
@@ -0,0 +1,26 @@
1
Added:
class CreateCrops < ActiveRecord::Migration[8.0]
2
Added:
def change
3
Added:
create_table :crops do |t|
4
Added:
t.string :name
5
Added:
t.integer :crop_type, null: false, default: 1
6
Added:
t.float :nno3
7
Added:
t.float :p
8
Added:
t.float :k
9
Added:
t.float :ca
10
Added:
t.float :mg
11
Added:
t.float :s
12
Added:
t.float :na
13
Added:
t.float :cl
14
Added:
t.float :si
15
Added:
t.float :fe
16
Added:
t.float :zn
17
Added:
t.float :b
18
Added:
t.float :mn
19
Added:
t.float :cu
20
Added:
t.float :mo
21
Added:
t.float :nnh4
22
Added:
23
Added:
t.timestamps
24
Added:
end
25
Added:
end
26
Added:
end
db/migrate/20250823142743_create_beds.rb
@@ -0,0 +1,11 @@
1
Added:
class CreateBeds < ActiveRecord::Migration[8.0]
2
Added:
def change
3
Added:
create_table :beds do |t|
4
Added:
t.integer :location, null: false
5
Added:
6
Added:
t.timestamps
7
Added:
end
8
Added:
9
Added:
add_index :beds, :location, unique: true
10
Added:
end
11
Added:
end
db/migrate/20250823142858_create_rafts.rb
@@ -0,0 +1,13 @@
1
Added:
class CreateRafts < ActiveRecord::Migration[8.0]
2
Added:
def change
3
Added:
create_table :rafts do |t|
4
Added:
t.references :bed, null: false, foreign_key: true
5
Added:
t.integer :location, null: false
6
Added:
t.references :crop, null: true, foreign_key: true
7
Added:
8
Added:
t.timestamps
9
Added:
end
10
Added:
11
Added:
add_index :rafts, [ :bed_id, :location ], unique: true
12
Added:
end
13
Added:
end
db/migrate/20250824121914_create_fertilizer_components.rb
@@ -0,0 +1,26 @@
1
Added:
class CreateFertilizerComponents < ActiveRecord::Migration[8.0]
2
Added:
def change
3
Added:
create_table :fertilizer_components do |t|
4
Added:
t.string :name
5
Added:
t.string :formula
6
Added:
t.float :nno3
7
Added:
t.float :nnh4
8
Added:
t.float :p
9
Added:
t.float :k
10
Added:
t.float :ca
11
Added:
t.float :mg
12
Added:
t.float :s
13
Added:
t.float :na
14
Added:
t.float :cl
15
Added:
t.float :si
16
Added:
t.float :fe
17
Added:
t.float :zn
18
Added:
t.float :b
19
Added:
t.float :mn
20
Added:
t.float :cu
21
Added:
t.float :mo
22
Added:
23
Added:
t.timestamps
24
Added:
end
25
Added:
end
26
Added:
end
db/migrate/20250824163242_create_fertilizer_products.rb
@@ -0,0 +1,11 @@
1
Added:
class CreateFertilizerProducts < ActiveRecord::Migration[8.0]
2
Added:
def change
3
Added:
create_table :fertilizer_products do |t|
4
Added:
t.string :name, null: false
5
Added:
t.decimal :purity, precision: 5, scale: 2, null: false, default: 100.00
6
Added:
7
Added:
t.timestamps
8
Added:
end
9
Added:
add_index :fertilizer_products, :name, unique: true
10
Added:
end
11
Added:
end
db/migrate/20250824163257_create_fertilizer_compositions.rb
@@ -0,0 +1,11 @@
1
Added:
class CreateFertilizerCompositions < ActiveRecord::Migration[8.0]
2
Added:
def change
3
Added:
create_table :fertilizer_compositions do |t|
4
Added:
t.references :fertilizer_product, null: false, foreign_key: true
5
Added:
t.references :fertilizer_component, null: false, foreign_key: true
6
Added:
t.decimal :percent_w, precision: 6, scale: 3, null: false # e.g. 13.500 (% w/w)
7
Added:
8
Added:
t.timestamps
9
Added:
end
10
Added:
end
11
Added:
end
db/schema.rb
@@ -0,0 +1,130 @@
1
Added:
# This file is auto-generated from the current state of the database. Instead
2
Added:
# of editing this file, please use the migrations feature of Active Record to
3
Added:
# incrementally modify your database, and then regenerate this schema definition.
4
Added:
#
5
Added:
# This file is the source Rails uses to define your schema when running `bin/rails
6
Added:
# db:schema:load`. When creating a new database, `bin/rails db:schema:load` tends to
7
Added:
# be faster and is potentially less error prone than running all of your
8
Added:
# migrations from scratch. Old migrations may fail to apply correctly if those
9
Added:
# migrations use external dependencies or application code.
10
Added:
#
11
Added:
# It's strongly recommended that you check this file into your version control system.
12
Added:
13
Added:
ActiveRecord::Schema[8.0].define(version: 2025_08_24_163257) do
14
Added:
create_table "beds", force: :cascade do |t|
15
Added:
t.integer "location", null: false
16
Added:
t.datetime "created_at", null: false
17
Added:
t.datetime "updated_at", null: false
18
Added:
t.index ["location"], name: "index_beds_on_location", unique: true
19
Added:
end
20
Added:
21
Added:
create_table "crops", force: :cascade do |t|
22
Added:
t.string "name"
23
Added:
t.integer "crop_type", default: 1, null: false
24
Added:
t.float "nno3"
25
Added:
t.float "p"
26
Added:
t.float "k"
27
Added:
t.float "ca"
28
Added:
t.float "mg"
29
Added:
t.float "s"
30
Added:
t.float "na"
31
Added:
t.float "cl"
32
Added:
t.float "si"
33
Added:
t.float "fe"
34
Added:
t.float "zn"
35
Added:
t.float "b"
36
Added:
t.float "mn"
37
Added:
t.float "cu"
38
Added:
t.float "mo"
39
Added:
t.float "nnh4"
40
Added:
t.datetime "created_at", null: false
41
Added:
t.datetime "updated_at", null: false
42
Added:
end
43
Added:
44
Added:
create_table "fertilizer_components", force: :cascade do |t|
45
Added:
t.string "name"
46
Added:
t.string "formula"
47
Added:
t.float "nno3"
48
Added:
t.float "nnh4"
49
Added:
t.float "p"
50
Added:
t.float "k"
51
Added:
t.float "ca"
52
Added:
t.float "mg"
53
Added:
t.float "s"
54
Added:
t.float "na"
55
Added:
t.float "cl"
56
Added:
t.float "si"
57
Added:
t.float "fe"
58
Added:
t.float "zn"
59
Added:
t.float "b"
60
Added:
t.float "mn"
61
Added:
t.float "cu"
62
Added:
t.float "mo"
63
Added:
t.datetime "created_at", null: false
64
Added:
t.datetime "updated_at", null: false
65
Added:
end
66
Added:
67
Added:
create_table "fertilizer_compositions", force: :cascade do |t|
68
Added:
t.integer "fertilizer_product_id", null: false
69
Added:
t.integer "fertilizer_component_id", null: false
70
Added:
t.decimal "percent_w", precision: 6, scale: 3, null: false
71
Added:
t.datetime "created_at", null: false
72
Added:
t.datetime "updated_at", null: false
73
Added:
t.index ["fertilizer_component_id"], name: "index_fertilizer_compositions_on_fertilizer_component_id"
74
Added:
t.index ["fertilizer_product_id"], name: "index_fertilizer_compositions_on_fertilizer_product_id"
75
Added:
end
76
Added:
77
Added:
create_table "fertilizer_products", force: :cascade do |t|
78
Added:
t.string "name", null: false
79
Added:
t.decimal "purity", precision: 5, scale: 2, default: "100.0", null: false
80
Added:
t.datetime "created_at", null: false
81
Added:
t.datetime "updated_at", null: false
82
Added:
t.index ["name"], name: "index_fertilizer_products_on_name", unique: true
83
Added:
end
84
Added:
85
Added:
create_table "nutrient_measurements", force: :cascade do |t|
86
Added:
t.date "measured_on"
87
Added:
t.float "nno3"
88
Added:
t.float "p"
89
Added:
t.float "k"
90
Added:
t.float "ca"
91
Added:
t.float "mg"
92
Added:
t.float "s"
93
Added:
t.float "na"
94
Added:
t.float "cl"
95
Added:
t.float "si"
96
Added:
t.float "fe"
97
Added:
t.float "zn"
98
Added:
t.float "b"
99
Added:
t.float "mn"
100
Added:
t.float "cu"
101
Added:
t.float "mo"
102
Added:
t.float "nnh4"
103
Added:
t.datetime "created_at", null: false
104
Added:
t.datetime "updated_at", null: false
105
Added:
t.index ["measured_on"], name: "index_nutrient_measurements_on_measured_on", unique: true
106
Added:
end
107
Added:
108
Added:
create_table "nutrients", force: :cascade do |t|
109
Added:
t.string "formula"
110
Added:
t.string "name"
111
Added:
t.datetime "created_at", null: false
112
Added:
t.datetime "updated_at", null: false
113
Added:
end
114
Added:
115
Added:
create_table "rafts", force: :cascade do |t|
116
Added:
t.integer "bed_id", null: false
117
Added:
t.integer "location", null: false
118
Added:
t.integer "crop_id"
119
Added:
t.datetime "created_at", null: false
120
Added:
t.datetime "updated_at", null: false
121
Added:
t.index ["bed_id", "location"], name: "index_rafts_on_bed_id_and_location", unique: true
122
Added:
t.index ["bed_id"], name: "index_rafts_on_bed_id"
123
Added:
t.index ["crop_id"], name: "index_rafts_on_crop_id"
124
Added:
end
125
Added:
126
Added:
add_foreign_key "fertilizer_compositions", "fertilizer_components"
127
Added:
add_foreign_key "fertilizer_compositions", "fertilizer_products"
128
Added:
add_foreign_key "rafts", "beds"
129
Added:
add_foreign_key "rafts", "crops"
130
Added:
end
db/seeds.rb
@@ -0,0 +1,13 @@
1
Added:
# This file should ensure the existence of records required to run the application in every environment (production,
2
Added:
# development, test). The code here should be idempotent so that it can be executed at any point in every environment.
3
Added:
# The data can then be loaded with the bin/rails db:seed command (or created alongside the database with db:setup).
4
Added:
#
5
Added:
# Example:
6
Added:
#
7
Added:
# ["Action", "Comedy", "Drama", "Horror"].each do |genre_name|
8
Added:
# MovieGenre.find_or_create_by!(name: genre_name)
9
Added:
# end
10
Added:
11
Added:
Dir[Rails.root.join("db/seeds/*.rb")].sort.each do |seed|
12
Added:
load seed
13
Added:
end
db/seeds/1_nutrients.rb
@@ -0,0 +1,24 @@
1
Added:
NUTRIENTS = [
2
Added:
[ "nno3", "nitrate" ],
3
Added:
[ "p", "phosphore" ],
4
Added:
[ "k", "potassium" ],
5
Added:
[ "ca", "calcium" ],
6
Added:
[ "mg", "magnésium" ],
7
Added:
[ "s", "soufre" ],
8
Added:
[ "na", "sodium" ],
9
Added:
[ "cl", "chlore" ],
10
Added:
[ "si", "silice" ],
11
Added:
[ "fe", "fer" ],
12
Added:
[ "zn", "zinc" ],
13
Added:
[ "b", "bore" ],
14
Added:
[ "mn", "manganèse" ],
15
Added:
[ "cu", "cuivre" ],
16
Added:
[ "mo", "molybdène" ],
17
Added:
[ "nnh4", "ammonium" ]
18
Added:
]
19
Added:
20
Added:
NUTRIENTS.each do |formula, name|
21
Added:
Nutrient.find_or_create_by!(formula:) { |n| n.name = name }
22
Added:
end
23
Added:
24
Added:
puts "Nutrients: #{Nutrient.count}"
db/seeds/2_nutrient_measurements.rb
@@ -0,0 +1,27 @@
1
Added:
require "csv"
2
Added:
3
Added:
csv_path = Rails.root.join("db", "data", "dolibarr_measurements.csv")
4
Added:
abort "CSV not found: #{csv_path}" unless File.exist?(csv_path)
5
Added:
6
Added:
CSV.foreach(csv_path, headers: true) do |row|
7
Added:
NutrientMeasurement.find_or_create_by!(measured_on: Date.parse(row["date"])) do |m|
8
Added:
m.nno3 = row["nno3"]
9
Added:
m.p = row["p"]
10
Added:
m.k = row["k"]
11
Added:
m.ca = row["ca"]
12
Added:
m.mg = row["mg"]
13
Added:
m.s = row["s"]
14
Added:
m.na = row["na"]
15
Added:
m.cl = row["cl"]
16
Added:
m.si = row["si"]
17
Added:
m.fe = row["fe"]
18
Added:
m.zn = row["zn"]
19
Added:
m.b = row["b"]
20
Added:
m.mn = row["mn"]
21
Added:
m.cu = row["cu"]
22
Added:
m.mo = row["mo"]
23
Added:
m.nnh4 = row["nnh4"]
24
Added:
end
25
Added:
end
26
Added:
27
Added:
puts "NutrientMeasurements: #{NutrientMeasurement.count}"
db/seeds/3_crops.rb
@@ -0,0 +1,125 @@
1
Added:
# crop_type: 0=leafy greens, 1=fruits, 2=herbs
2
Added:
3
Added:
LEAFY = {
4
Added:
nno3: 150,
5
Added:
p: 31,
6
Added:
k: 210,
7
Added:
ca: 90,
8
Added:
mg: 24,
9
Added:
s: 32,
10
Added:
fe: 1.0,
11
Added:
mn: 0.25,
12
Added:
zn: 0.13,
13
Added:
b: 0.16,
14
Added:
cu: 0.023,
15
Added:
mo: 0.024,
16
Added:
nnh4: 5,
17
Added:
# keep low for leafy
18
Added:
na: 10,
19
Added:
cl: 5,
20
Added:
si: 20
21
Added:
}
22
Added:
23
Added:
HERB = LEAFY # Herbs run well on the Cornell leafy recipe
24
Added:
25
Added:
TOMATO = {
26
Added:
# CEAC Stage 3 "multi-crop" / mature tomato
27
Added:
nno3: 190,
28
Added:
p: 47,
29
Added:
k: 350,
30
Added:
ca: 200,
31
Added:
mg: 65,
32
Added:
s: 102,
33
Added:
fe: 2.0,
34
Added:
mn: 0.55,
35
Added:
zn: 0.33,
36
Added:
b: 0.28,
37
Added:
cu: 0.05,
38
Added:
mo: 0.05,
39
Added:
nnh4: 0,
40
Added:
# CEAC recipes are NO3-N; keep NH4 minimal
41
Added:
na: 20,
42
Added:
cl: 25,
43
Added:
si: 20
44
Added:
}
45
Added:
46
Added:
HOT_PEPPER = {
47
Added:
# Mature greenhouse pepper (HortAmericas summary of UA recipes)
48
Added:
nno3: 180,
49
Added:
p: 50,
50
Added:
k: 280,
51
Added:
ca: 200,
52
Added:
mg: 45,
53
Added:
s: 20,
54
Added:
fe: 1.0,
55
Added:
mn: 0.55,
56
Added:
zn: 0.33,
57
Added:
b: 0.30,
58
Added:
cu: 0.05,
59
Added:
mo: 0.05,
60
Added:
nnh4: 15,
61
Added:
na: 20,
62
Added:
cl: 10,
63
Added:
si: 20
64
Added:
}
65
Added:
66
Added:
STRAWBERRY = {
67
Added:
# UA strawberry (Yamazaki) emphasizes lower EC; use conservative macros
68
Added:
nno3: 120,
69
Added:
p: 30,
70
Added:
k: 200,
71
Added:
ca: 120,
72
Added:
mg: 35,
73
Added:
s: 50,
74
Added:
fe: 1.5,
75
Added:
mn: 0.50,
76
Added:
zn: 0.20,
77
Added:
b: 0.30,
78
Added:
cu: 0.05,
79
Added:
mo: 0.05,
80
Added:
nnh4: 5,
81
Added:
na: 10,
82
Added:
cl: 5,
83
Added:
si: 20
84
Added:
}
85
Added:
86
Added:
RASPBERRY = {
87
Added:
# Sparse data; align with strawberry but a touch higher vigor
88
Added:
nno3: 140,
89
Added:
p: 35,
90
Added:
k: 230,
91
Added:
ca: 150,
92
Added:
mg: 40,
93
Added:
s: 50,
94
Added:
fe: 1.5,
95
Added:
mn: 0.50,
96
Added:
zn: 0.20,
97
Added:
b: 0.30,
98
Added:
cu: 0.05,
99
Added:
mo: 0.05,
100
Added:
nnh4: 5,
101
Added:
na: 15,
102
Added:
cl: 5,
103
Added:
si: 20
104
Added:
}
105
Added:
106
Added:
[
107
Added:
[ "lettuce", 0, LEAFY ],
108
Added:
[ "kale", 0, LEAFY ],
109
Added:
[ "chinese cabbage", 0, LEAFY ],
110
Added:
[ "tomatoes", 1, TOMATO ],
111
Added:
[ "raspberries", 1, RASPBERRY ],
112
Added:
[ "strawberries", 1, STRAWBERRY ],
113
Added:
[ "hot peppers", 1, HOT_PEPPER ],
114
Added:
[ "parsley", 2, HERB ],
115
Added:
[ "chives", 2, HERB ],
116
Added:
[ "italian basil", 2, HERB ],
117
Added:
[ "dill", 2, HERB ]
118
Added:
].each do |name, type, nutrient_requirements|
119
Added:
Crop.find_or_create_by!(name: name) do |c|
120
Added:
c.crop_type = type
121
Added:
c.attributes = nutrient_requirements
122
Added:
end
123
Added:
end
124
Added:
125
Added:
puts "Crops: #{Crop.count}"
db/seeds/4_beds_and_rafts.rb
@@ -0,0 +1,24 @@
1
Added:
BEDS = 14
2
Added:
RAFTS = 10
3
Added:
4
Added:
1.upto(BEDS) do |b|
5
Added:
bed = Bed.find_or_create_by!(location: b)
6
Added:
7
Added:
crop_name = case b
8
Added:
when 1..2 then "tomatoes"
9
Added:
when 3 then "hot peppers"
10
Added:
when 4 then "chives"
11
Added:
when 5 then "italian basil"
12
Added:
when 6..7 then "chinese cabbage"
13
Added:
else "lettuce"
14
Added:
end
15
Added:
16
Added:
1.upto(RAFTS) do |r|
17
Added:
raft = bed.rafts.find_or_create_by!(location: r) do |raft|
18
Added:
raft.crop = Crop.find_by!(name: crop_name)
19
Added:
end
20
Added:
end
21
Added:
end
22
Added:
23
Added:
puts "Beds: #{Bed.count}"
24
Added:
puts "Rafts: #{Raft.count}"
db/seeds/5_fertilizer_components.rb.bkp
@@ -0,0 +1,38 @@
1
Added:
FERTILIZER_COMPONENTS = [
2
Added:
# Macros / bases
3
Added:
{ name: "Potassium Nitrate", formula: "KNO3", nno3: 13.50, k: 38.60 },
4
Added:
{ name: "Calcium Nitrate", formula: "Ca(NO3)2·xH2O", nno3: 15.50, ca: 18.94 },
5
Added:
{ name: "Ammonium Nitrate", formula: "NH4NO3", nno3: 13.50, nnh4: 13.50 }, # total N ≈ 27
6
Added:
{ name: "Diammonium Phosphate", formula: "(NH4)2HPO4", p: 21.00 }, # NH4 can be added later if desired
7
Added:
8
Added:
# Acids / buffers
9
Added:
{ name: "Nitric Acid 53%", formula: "HNO3", nno3: 11.70 },
10
Added:
{ name: "Potassium Bicarbonate", formula: "KHCO3", k: 39.05 },
11
Added:
{ name: "Calcium Carbonate", formula: "CaCO3", ca: 38.00 },
12
Added:
13
Added:
# K–Mg–S complex (Patentkali-type blend)
14
Added:
{ name: "Potassium Sulfate blend (K–Mg–S + NaCl)", formula: "K2SO4+MgSO4+NaCl",
15
Added:
p: 0.44, k: 22.66, mg: 6.16, s: 17.77, na: 2.16, cl: 3.34 },
16
Added:
17
Added:
# Sulfates (micros / secondary)
18
Added:
{ name: "Magnesium Sulfate", formula: "MgSO4·7H2O", mg: 9.648, s: 13.016 },
19
Added:
{ name: "Manganese Sulfate", formula: "MnSO4", s: 7.17, mn: 12.00 },
20
Added:
{ name: "Zinc Sulfate (Fiza Zinc)", formula: "ZnSO4", zn: 12.00 },
21
Added:
22
Added:
# Chelates / traces
23
Added:
{ name: "Iron DTPA 11.8%", formula: "Fe-DTPA", fe: 11.80 },
24
Added:
{ name: "HelioCopper (Cu chelate)", formula: "Cu-chelate", cu: 40.00 },
25
Added:
26
Added:
# Boron & Mo sources
27
Added:
{ name: "Boron–Molybdenum (Boronia LS)", formula: "B+Mo", b: 13.50, mo: 0.028 },
28
Added:
{ name: "Boronia MO12 (10L)", formula: "B+Mn+Cu", b: 8.90, mn: 0.089, cu: 0.89 },
29
Added:
{ name: "Sodium Molybdate", formula: "Na2MoO4", mo: 39.50 }
30
Added:
]
31
Added:
32
Added:
FERTILIZER_COMPONENTS.each do |attrs|
33
Added:
FertilizerComponent.find_or_create_by!(name: attrs[:name]) do |c|
34
Added:
c.attributes = attrs
35
Added:
end
36
Added:
end
37
Added:
38
Added:
puts "Fertilizer components: #{FertilizerComponent.count}"
db/seeds/6_fertilizer_products.rb
@@ -0,0 +1,143 @@
1
Added:
FERTILIZER_RECIPES = [
2
Added:
{
3
Added:
name: "Multi K Reci",
4
Added:
purity: 99.0,
5
Added:
composition: [
6
Added:
{ component: {
7
Added:
name: "Potassium nitrate",
8
Added:
formula: "KNO3",
9
Added:
nno3: 13.0,
10
Added:
k: 46.0 },
11
Added:
percent_w: 100.0 }
12
Added:
]
13
Added:
},
14
Added:
{
15
Added:
name: "Fixa Mn",
16
Added:
purity: 98.0,
17
Added:
composition: [
18
Added:
{ component: {
19
Added:
name: "Manganese sulfate",
20
Added:
formula: "MnSO4·H2O",
21
Added:
mn: 32.0,
22
Added:
s: 18.0 },
23
Added:
percent_w: 100.0 }
24
Added:
]
25
Added:
},
26
Added:
{
27
Added:
name: "Multi-Cal Haïfa",
28
Added:
purity: 99.0,
29
Added:
composition: [
30
Added:
{ component: {
31
Added:
name: "Calcium nitrate",
32
Added:
formula: "Ca(NO3)2·4H2O",
33
Added:
nno3: 15.5,
34
Added:
ca: 19.0 },
35
Added:
percent_w: 100.0 }
36
Added:
]
37
Added:
},
38
Added:
{
39
Added:
name: "DAP 18/46/00",
40
Added:
purity: 100.0,
41
Added:
composition: [
42
Added:
{ component: {
43
Added:
name: "Diammonium phosphate",
44
Added:
formula: "(NH4)2HPO4",
45
Added:
nnh4: 18.0,
46
Added:
p: 20.0 },
47
Added:
percent_w: 100.0 }
48
Added:
]
49
Added:
},
50
Added:
{
51
Added:
name: "Patenkali",
52
Added:
purity: 100.0,
53
Added:
composition: [
54
Added:
{ component: {
55
Added:
name: "Potassium sulfate",
56
Added:
formula: "K2SO4",
57
Added:
k: 50.0,
58
Added:
s: 18.0
59
Added:
}, percent_w: 100.0 }
60
Added:
]
61
Added:
},
62
Added:
{
63
Added:
name: "Eso Top",
64
Added:
purity: 100.0,
65
Added:
composition: [
66
Added:
{ component: {
67
Added:
name: "Magnesium sulfate",
68
Added:
formula: "MgSO4·7H2O",
69
Added:
mg: 9.8,
70
Added:
s: 13.0 },
71
Added:
percent_w: 100.0 }
72
Added:
]
73
Added:
},
74
Added:
{
75
Added:
name: "Ammonitrate 27",
76
Added:
purity: 100.0,
77
Added:
composition: [
78
Added:
{ component: {
79
Added:
name: "Ammonium nitrate",
80
Added:
formula: "NH4NO3",
81
Added:
nno3: 13.5,
82
Added:
nnh4: 13.5 },
83
Added:
percent_w: 100.0 }
84
Added:
]
85
Added:
},
86
Added:
{
87
Added:
name: "Fer chélaté",
88
Added:
purity: 100.0,
89
Added:
composition: [
90
Added:
{ component: {
91
Added:
name: "Iron chelate (EDDHA)",
92
Added:
formula: "Fe-EDDHA",
93
Added:
fe: 6.0 },
94
Added:
percent_w: 100.0 }
95
Added:
]
96
Added:
},
97
Added:
{
98
Added:
name: "Carbonate de calcium",
99
Added:
purity: 100.0,
100
Added:
composition: [
101
Added:
{ component: {
102
Added:
name: "Calcium carbonate",
103
Added:
formula: "CaCO3",
104
Added:
ca: 40.0 },
105
Added:
percent_w: 100.0 }
106
Added:
]
107
Added:
},
108
Added:
{
109
Added:
name: "Héliocuivre",
110
Added:
purity: 100.0,
111
Added:
composition: [
112
Added:
{ component: {
113
Added:
name: "Copper chelate (EDTA)",
114
Added:
formula: "Cu-EDTA",
115
Added:
cu: 14.0 },
116
Added:
percent_w: 100.0 }
117
Added:
]
118
Added:
}
119
Added:
]
120
Added:
121
Added:
FERTILIZER_RECIPES.each do |recipe|
122
Added:
product = FertilizerProduct.find_or_create_by!(name: recipe[:name]) do |fp|
123
Added:
fp.purity = recipe[:purity]
124
Added:
end
125
Added:
126
Added:
recipe[:composition].each do |c|
127
Added:
comp_attrs = c[:component]
128
Added:
component = FertilizerComponent.find_or_create_by!(name: comp_attrs[:name]) do |fc|
129
Added:
fc.formula = comp_attrs[:formula]
130
Added:
end
131
Added:
# update nutrient fields if missing
132
Added:
component.update!(comp_attrs.except(:name, :formula))
133
Added:
134
Added:
FertilizerComposition.find_or_create_by!(
135
Added:
fertilizer_product: product,
136
Added:
fertilizer_component: component
137
Added:
) do |fc|
138
Added:
fc.percent_w = c[:percent_w]
139
Added:
end
140
Added:
end
141
Added:
end
142
Added:
143
Added:
puts "FertilizerProducts: #{FertilizerProduct.count}"
lib/tasks/.keep
log/.keep
public/400.html
@@ -0,0 +1,114 @@
1
Added:
<!doctype html>
2
Added:
3
Added:
<html lang="en">
4
Added:
5
Added:
<head>
6
Added:
7
Added:
<title>The server cannot process the request due to a client error (400 Bad Request)</title>
8
Added:
9
Added:
<meta charset="utf-8">
10
Added:
<meta name="viewport" content="initial-scale=1, width=device-width">
11
Added:
<meta name="robots" content="noindex, nofollow">
12
Added:
13
Added:
<style>
14
Added:
15
Added:
*, *::before, *::after {
16
Added:
box-sizing: border-box;
17
Added:
}
18
Added:
19
Added:
* {
20
Added:
margin: 0;
21
Added:
}
22
Added:
23
Added:
html {
24
Added:
font-size: 16px;
25
Added:
}
26
Added:
27
Added:
body {
28
Added:
background: #FFF;
29
Added:
color: #261B23;
30
Added:
display: grid;
31
Added:
font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, Aptos, Roboto, "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
32
Added:
font-size: clamp(1rem, 2.5vw, 2rem);
33
Added:
-webkit-font-smoothing: antialiased;
34
Added:
font-style: normal;
35
Added:
font-weight: 400;
36
Added:
letter-spacing: -0.0025em;
37
Added:
line-height: 1.4;
38
Added:
min-height: 100vh;
39
Added:
place-items: center;
40
Added:
text-rendering: optimizeLegibility;
41
Added:
-webkit-text-size-adjust: 100%;
42
Added:
}
43
Added:
44
Added:
a {
45
Added:
color: inherit;
46
Added:
font-weight: 700;
47
Added:
text-decoration: underline;
48
Added:
text-underline-offset: 0.0925em;
49
Added:
}
50
Added:
51
Added:
b, strong {
52
Added:
font-weight: 700;
53
Added:
}
54
Added:
55
Added:
i, em {
56
Added:
font-style: italic;
57
Added:
}
58
Added:
59
Added:
main {
60
Added:
display: grid;
61
Added:
gap: 1em;
62
Added:
padding: 2em;
63
Added:
place-items: center;
64
Added:
text-align: center;
65
Added:
}
66
Added:
67
Added:
main header {
68
Added:
width: min(100%, 12em);
69
Added:
}
70
Added:
71
Added:
main header svg {
72
Added:
height: auto;
73
Added:
max-width: 100%;
74
Added:
width: 100%;
75
Added:
}
76
Added:
77
Added:
main article {
78
Added:
width: min(100%, 30em);
79
Added:
}
80
Added:
81
Added:
main article p {
82
Added:
font-size: 75%;
83
Added:
}
84
Added:
85
Added:
main article br {
86
Added:
87
Added:
display: none;
88
Added:
89
Added:
@media(min-width: 48em) {
90
Added:
display: inline;
91
Added:
}
92
Added:
93
Added:
}
94
Added:
95
Added:
</style>
96
Added:
97
Added:
</head>
98
Added:
99
Added:
<body>
100
Added:
101
Added:
<!-- This file lives in public/400.html -->
102
Added:
103
Added:
<main>
104
Added:
<header>
105
Added:
<svg height="172" viewBox="0 0 480 172" width="480" xmlns="http://www.w3.org/2000/svg"><path d="m124.48 3.00509-45.6889 100.02991h26.2239v-28.1168h38.119v28.1168h21.628v35.145h-21.628v30.82h-37.308v-30.82h-72.1833v-31.901l50.2851-103.27391zm115.583 168.69891c-40.822 0-64.884-35.146-64.884-85.7015 0-50.5554 24.062-85.700907 64.884-85.700907 40.823 0 64.884 35.145507 64.884 85.700907 0 50.5555-24.061 85.7015-64.884 85.7015zm0-133.2831c-17.572 0-22.709 21.8984-22.709 47.5816 0 25.6835 5.137 47.5815 22.709 47.5815 17.303 0 22.71-21.898 22.71-47.5815 0-25.6832-5.407-47.5816-22.71-47.5816zm140.456 133.2831c-40.823 0-64.884-35.146-64.884-85.7015 0-50.5554 24.061-85.700907 64.884-85.700907 40.822 0 64.884 35.145507 64.884 85.700907 0 50.5555-24.062 85.7015-64.884 85.7015zm0-133.2831c-17.573 0-22.71 21.8984-22.71 47.5816 0 25.6835 5.137 47.5815 22.71 47.5815 17.302 0 22.709-21.898 22.709-47.5815 0-25.6832-5.407-47.5816-22.709-47.5816z" fill="#f0eff0"/><path d="m123.606 85.4445c3.212 1.0523 5.538 4.2089 5.538 8.0301 0 6.1472-4.209 9.5254-11.298 9.5254h-15.617v-34.0033h14.565c7.089 0 11.353 3.1566 11.353 9.2484 0 3.6551-2.049 6.3134-4.541 7.1994zm-12.904-2.9905h5.095c2.603 0 3.988-.9968 3.988-3.1013 0-2.1044-1.385-3.0459-3.988-3.0459h-5.095zm0 6.6456v6.5902h5.981c2.492 0 3.877-1.3291 3.877-3.2674 0-2.049-1.385-3.3228-3.877-3.3228zm43.786 13.9004h-8.362v-1.274c-.831.831-3.323 1.717-5.981 1.717-4.929 0-9.083-2.769-9.083-8.0301 0-4.818 4.154-7.9193 9.581-7.9193 2.049 0 4.486.6646 5.483 1.3845v-1.606c0-1.606-.942-2.9905-3.046-2.9905-1.606 0-2.548.7199-2.935 1.8275h-8.197c.72-4.8181 4.985-8.6393 11.409-8.6393 7.088 0 11.131 3.7659 11.131 10.2453zm-8.362-6.9779v-1.4399c-.554-1.0522-2.049-1.7167-3.655-1.7167-1.717 0-3.434.7199-3.434 2.3813 0 1.7168 1.717 2.4367 3.434 2.4367 1.606 0 3.101-.6645 3.655-1.6614zm27.996 6.9779v-1.994c-1.163 1.329-3.599 2.548-6.147 2.548-7.199 0-11.131-5.8151-11.131-13.0145s3.932-13.0143 11.131-13.0143c2.548 0 4.984 1.2184 6.147 2.5475v-13.0697h8.695v35.997zm0-9.1931v-6.5902c-.664-1.3291-2.159-2.326-3.821-2.326-2.99 0-4.763 2.4368-4.763 5.6488s1.773 5.5934 4.763 5.5934c1.717 0 3.157-.9415 3.821-2.326zm35.471-2.049h-3.101v11.2421h-8.806v-34.0033h15.285c7.31 0 12.35 4.1535 12.35 11.5744 0 5.1503-2.603 8.6947-6.757 10.2453l7.975 12.1836h-9.858zm-3.101-15.2849v8.1962h5.538c3.156 0 4.596-1.606 4.596-4.0981s-1.44-4.0981-4.596-4.0981zm36.957 17.8323h8.03c-.886 5.7597-5.206 9.2487-11.685 9.2487-7.643 0-12.682-5.2613-12.682-13.0145 0-7.6978 5.316-13.0143 12.515-13.0143 7.643 0 11.962 5.095 11.962 12.5159v2.1598h-16.115c.277 2.9905 1.827 4.5965 4.32 4.5965 1.772 0 3.156-.7753 3.655-2.4921zm-3.822-10.0237c-2.049 0-3.433 1.2737-3.987 3.5997h7.532c-.111-2.0491-1.385-3.5997-3.545-3.5997zm30.98 27.5234v-10.799c-1.163 1.329-3.6 2.548-6.147 2.548-7.2 0-11.132-5.9259-11.132-13.0145 0-7.144 3.932-13.0143 11.132-13.0143 2.547 0 4.984 1.2184 6.147 2.5475v-1.9937h8.695v33.726zm0-17.9981v-6.5902c-.665-1.3291-2.105-2.326-3.821-2.326-2.991 0-4.763 2.4368-4.763 5.6488s1.772 5.5934 4.763 5.5934c1.661 0 3.156-.9415 3.821-2.326zm36.789-15.7279v24.921h-8.695v-2.16c-1.329 1.551-3.821 2.714-6.646 2.714-5.482 0-8.75-3.5999-8.75-9.1379v-16.3371h8.64v14.288c0 2.1045.996 3.5997 3.212 3.5997 1.606 0 3.101-1.0522 3.544-2.769v-15.1187zm19.084 16.2263h8.03c-.886 5.7597-5.206 9.2487-11.685 9.2487-7.643 0-12.682-5.2613-12.682-13.0145 0-7.6978 5.316-13.0143 12.515-13.0143 7.643 0 11.963 5.095 11.963 12.5159v2.1598h-16.116c.277 2.9905 1.828 4.5965 4.32 4.5965 1.772 0 3.156-.7753 3.655-2.4921zm-3.822-10.0237c-2.049 0-3.433 1.2737-3.987 3.5997h7.532c-.111-2.0491-1.385-3.5997-3.545-3.5997zm13.428 11.0206h8.474c.387 1.3845 1.606 2.1598 3.156 2.1598 1.44 0 2.548-.5538 2.548-1.7168 0-.9414-.72-1.2737-1.939-1.5506l-4.873-.9969c-4.154-.886-6.867-2.8797-6.867-7.2547 0-5.3165 4.762-8.4178 10.633-8.4178 6.812 0 10.522 3.1567 11.297 8.0855h-8.03c-.277-1.0522-1.052-1.9937-3.046-1.9937-1.273 0-2.326.5538-2.326 1.6614 0 .7753.554 1.163 1.717 1.3845l4.929 1.163c4.541 1.0522 6.978 3.4335 6.978 7.4763 0 5.3168-4.818 8.2518-10.91 8.2518-6.369 0-10.965-2.88-11.741-8.2518zm27.538-.8861v-9.5807h-3.655v-6.7564h3.655v-6.8671h8.584v6.8671h5.205v6.7564h-5.205v8.307c0 1.9383.941 2.769 2.658 2.769.941 0 1.993-.2216 2.769-.5538v7.3654c-.997.443-2.88.775-4.818.775-5.871 0-9.193-2.769-9.193-9.0819z" fill="#d30001"/></svg>
106
Added:
</header>
107
Added:
<article>
108
Added:
<p><strong>The server cannot process the request due to a client error.</strong> Please check the request and try again. If you’re the application owner check the logs for more information.</p>
109
Added:
</article>
110
Added:
</main>
111
Added:
112
Added:
</body>
113
Added:
114
Added:
</html>
public/404.html
@@ -0,0 +1,114 @@
1
Added:
<!doctype html>
2
Added:
3
Added:
<html lang="en">
4
Added:
5
Added:
<head>
6
Added:
7
Added:
<title>The page you were looking for doesn’t exist (404 Not found)</title>
8
Added:
9
Added:
<meta charset="utf-8">
10
Added:
<meta name="viewport" content="initial-scale=1, width=device-width">
11
Added:
<meta name="robots" content="noindex, nofollow">
12
Added:
13
Added:
<style>
14
Added:
15
Added:
*, *::before, *::after {
16
Added:
box-sizing: border-box;
17
Added:
}
18
Added:
19
Added:
* {
20
Added:
margin: 0;
21
Added:
}
22
Added:
23
Added:
html {
24
Added:
font-size: 16px;
25
Added:
}
26
Added:
27
Added:
body {
28
Added:
background: #FFF;
29
Added:
color: #261B23;
30
Added:
display: grid;
31
Added:
font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, Aptos, Roboto, "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
32
Added:
font-size: clamp(1rem, 2.5vw, 2rem);
33
Added:
-webkit-font-smoothing: antialiased;
34
Added:
font-style: normal;
35
Added:
font-weight: 400;
36
Added:
letter-spacing: -0.0025em;
37
Added:
line-height: 1.4;
38
Added:
min-height: 100vh;
39
Added:
place-items: center;
40
Added:
text-rendering: optimizeLegibility;
41
Added:
-webkit-text-size-adjust: 100%;
42
Added:
}
43
Added:
44
Added:
a {
45
Added:
color: inherit;
46
Added:
font-weight: 700;
47
Added:
text-decoration: underline;
48
Added:
text-underline-offset: 0.0925em;
49
Added:
}
50
Added:
51
Added:
b, strong {
52
Added:
font-weight: 700;
53
Added:
}
54
Added:
55
Added:
i, em {
56
Added:
font-style: italic;
57
Added:
}
58
Added:
59
Added:
main {
60
Added:
display: grid;
61
Added:
gap: 1em;
62
Added:
padding: 2em;
63
Added:
place-items: center;
64
Added:
text-align: center;
65
Added:
}
66
Added:
67
Added:
main header {
68
Added:
width: min(100%, 12em);
69
Added:
}
70
Added:
71
Added:
main header svg {
72
Added:
height: auto;
73
Added:
max-width: 100%;
74
Added:
width: 100%;
75
Added:
}
76
Added:
77
Added:
main article {
78
Added:
width: min(100%, 30em);
79
Added:
}
80
Added:
81
Added:
main article p {
82
Added:
font-size: 75%;
83
Added:
}
84
Added:
85
Added:
main article br {
86
Added:
87
Added:
display: none;
88
Added:
89
Added:
@media(min-width: 48em) {
90
Added:
display: inline;
91
Added:
}
92
Added:
93
Added:
}
94
Added:
95
Added:
</style>
96
Added:
97
Added:
</head>
98
Added:
99
Added:
<body>
100
Added:
101
Added:
<!-- This file lives in public/404.html -->
102
Added:
103
Added:
<main>
104
Added:
<header>
105
Added:
<svg height="172" viewBox="0 0 480 172" width="480" xmlns="http://www.w3.org/2000/svg"><path d="m124.48 3.00509-45.6889 100.02991h26.2239v-28.1168h38.119v28.1168h21.628v35.145h-21.628v30.82h-37.308v-30.82h-72.1833v-31.901l50.2851-103.27391zm115.583 168.69891c-40.822 0-64.884-35.146-64.884-85.7015 0-50.5554 24.062-85.700907 64.884-85.700907 40.823 0 64.884 35.145507 64.884 85.700907 0 50.5555-24.061 85.7015-64.884 85.7015zm0-133.2831c-17.572 0-22.709 21.8984-22.709 47.5816 0 25.6835 5.137 47.5815 22.709 47.5815 17.303 0 22.71-21.898 22.71-47.5815 0-25.6832-5.407-47.5816-22.71-47.5816zm165.328-35.41581-45.689 100.02991h26.224v-28.1168h38.119v28.1168h21.628v35.145h-21.628v30.82h-37.308v-30.82h-72.184v-31.901l50.285-103.27391z" fill="#f0eff0"/><path d="m157.758 68.9967v34.0033h-7.199l-14.233-19.8814v19.8814h-8.584v-34.0033h8.307l13.125 18.7184v-18.7184zm28.454 21.5428c0 7.6978-5.15 13.0145-12.737 13.0145-7.532 0-12.738-5.3167-12.738-13.0145s5.206-13.0143 12.738-13.0143c7.587 0 12.737 5.3165 12.737 13.0143zm-8.528 0c0-3.4336-1.496-5.8703-4.209-5.8703-2.659 0-4.154 2.4367-4.154 5.8703s1.495 5.8149 4.154 5.8149c2.713 0 4.209-2.3813 4.209-5.8149zm13.184 3.8766v-9.5807h-3.655v-6.7564h3.655v-6.8671h8.584v6.8671h5.205v6.7564h-5.205v8.307c0 1.9383.941 2.769 2.658 2.769.941 0 1.994-.2216 2.769-.5538v7.3654c-.997.443-2.88.775-4.818.775-5.87 0-9.193-2.769-9.193-9.0819zm37.027 8.5839h-8.806v-34.0033h23.924v7.6978h-15.118v6.7564h13.9v7.5316h-13.9zm41.876-12.4605c0 7.6978-5.15 13.0145-12.737 13.0145-7.532 0-12.738-5.3167-12.738-13.0145s5.206-13.0143 12.738-13.0143c7.587 0 12.737 5.3165 12.737 13.0143zm-8.529 0c0-3.4336-1.495-5.8703-4.208-5.8703-2.659 0-4.154 2.4367-4.154 5.8703s1.495 5.8149 4.154 5.8149c2.713 0 4.208-2.3813 4.208-5.8149zm35.337-12.4605v24.921h-8.695v-2.16c-1.329 1.551-3.821 2.714-6.646 2.714-5.482 0-8.75-3.5999-8.75-9.1379v-16.3371h8.64v14.288c0 2.1045.997 3.5997 3.212 3.5997 1.606 0 3.101-1.0522 3.544-2.769v-15.1187zm4.076 24.921v-24.921h8.694v2.1598c1.385-1.5506 3.822-2.7136 6.701-2.7136 5.538 0 8.806 3.5997 8.806 9.1377v16.3371h-8.639v-14.2327c0-2.049-1.053-3.5443-3.268-3.5443-1.717 0-3.156.9969-3.6 2.7136v15.0634zm44.113 0v-1.994c-1.163 1.329-3.6 2.548-6.147 2.548-7.2 0-11.132-5.8151-11.132-13.0145s3.932-13.0143 11.132-13.0143c2.547 0 4.984 1.2184 6.147 2.5475v-13.0697h8.695v35.997zm0-9.1931v-6.5902c-.665-1.3291-2.16-2.326-3.821-2.326-2.991 0-4.763 2.4368-4.763 5.6488s1.772 5.5934 4.763 5.5934c1.717 0 3.156-.9415 3.821-2.326z" fill="#d30001"/></svg>
106
Added:
</header>
107
Added:
<article>
108
Added:
<p><strong>The page you were looking for doesn’t exist.</strong> You may have mistyped the address or the page may have moved. If you’re the application owner check the logs for more information.</p>
109
Added:
</article>
110
Added:
</main>
111
Added:
112
Added:
</body>
113
Added:
114
Added:
</html>
public/406-unsupported-browser.html
@@ -0,0 +1,114 @@
1
Added:
<!doctype html>
2
Added:
3
Added:
<html lang="en">
4
Added:
5
Added:
<head>
6
Added:
7
Added:
<title>Your browser is not supported (406 Not Acceptable)</title>
8
Added:
9
Added:
<meta charset="utf-8">
10
Added:
<meta name="viewport" content="initial-scale=1, width=device-width">
11
Added:
<meta name="robots" content="noindex, nofollow">
12
Added:
13
Added:
<style>
14
Added:
15
Added:
*, *::before, *::after {
16
Added:
box-sizing: border-box;
17
Added:
}
18
Added:
19
Added:
* {
20
Added:
margin: 0;
21
Added:
}
22
Added:
23
Added:
html {
24
Added:
font-size: 16px;
25
Added:
}
26
Added:
27
Added:
body {
28
Added:
background: #FFF;
29
Added:
color: #261B23;
30
Added:
display: grid;
31
Added:
font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, Aptos, Roboto, "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
32
Added:
font-size: clamp(1rem, 2.5vw, 2rem);
33
Added:
-webkit-font-smoothing: antialiased;
34
Added:
font-style: normal;
35
Added:
font-weight: 400;
36
Added:
letter-spacing: -0.0025em;
37
Added:
line-height: 1.4;
38
Added:
min-height: 100vh;
39
Added:
place-items: center;
40
Added:
text-rendering: optimizeLegibility;
41
Added:
-webkit-text-size-adjust: 100%;
42
Added:
}
43
Added:
44
Added:
a {
45
Added:
color: inherit;
46
Added:
font-weight: 700;
47
Added:
text-decoration: underline;
48
Added:
text-underline-offset: 0.0925em;
49
Added:
}
50
Added:
51
Added:
b, strong {
52
Added:
font-weight: 700;
53
Added:
}
54
Added:
55
Added:
i, em {
56
Added:
font-style: italic;
57
Added:
}
58
Added:
59
Added:
main {
60
Added:
display: grid;
61
Added:
gap: 1em;
62
Added:
padding: 2em;
63
Added:
place-items: center;
64
Added:
text-align: center;
65
Added:
}
66
Added:
67
Added:
main header {
68
Added:
width: min(100%, 12em);
69
Added:
}
70
Added:
71
Added:
main header svg {
72
Added:
height: auto;
73
Added:
max-width: 100%;
74
Added:
width: 100%;
75
Added:
}
76
Added:
77
Added:
main article {
78
Added:
width: min(100%, 30em);
79
Added:
}
80
Added:
81
Added:
main article p {
82
Added:
font-size: 75%;
83
Added:
}
84
Added:
85
Added:
main article br {
86
Added:
87
Added:
display: none;
88
Added:
89
Added:
@media(min-width: 48em) {
90
Added:
display: inline;
91
Added:
}
92
Added:
93
Added:
}
94
Added:
95
Added:
</style>
96
Added:
97
Added:
</head>
98
Added:
99
Added:
<body>
100
Added:
101
Added:
<!-- This file lives in public/406-unsupported-browser.html -->
102
Added:
103
Added:
<main>
104
Added:
<header>
105
Added:
<svg height="172" viewBox="0 0 480 172" width="480" xmlns="http://www.w3.org/2000/svg"><path d="m124.48 3.00509-45.6889 100.02991h26.2239v-28.1168h38.119v28.1168h21.628v35.145h-21.628v30.82h-37.308v-30.82h-72.1833v-31.901l50.2851-103.27391zm115.583 168.69891c-40.822 0-64.884-35.146-64.884-85.7015 0-50.5554 24.062-85.700907 64.884-85.700907 40.823 0 64.884 35.145507 64.884 85.700907 0 50.5555-24.061 85.7015-64.884 85.7015zm0-133.2831c-17.572 0-22.709 21.8984-22.709 47.5816 0 25.6835 5.137 47.5815 22.709 47.5815 17.303 0 22.71-21.898 22.71-47.5815 0-25.6832-5.407-47.5816-22.71-47.5816zm202.906 9.7326h-41.093c-2.433-7.2994-7.84-12.4361-17.302-12.4361-16.221 0-25.413 17.5728-25.954 34.8752v1.3517c5.137-7.0291 16.221-12.4361 30.82-12.4361 33.524 0 54.881 24.0612 54.881 53.7998 0 33.253-23.791 58.396-61.64 58.396-21.628 0-39.741-10.003-50.825-27.576-9.733-14.599-13.788-32.442-13.788-54.3406 0-51.9072 24.331-89.485807 66.236-89.485807 32.712 0 53.258 18.654107 58.665 47.851907zm-82.727 66.2355c0 13.247 9.463 22.439 22.71 22.439 12.977 0 22.439-9.192 22.439-22.439 0-13.517-9.462-22.7091-22.439-22.7091-13.247 0-22.71 9.1921-22.71 22.7091z" fill="#f0eff0"/><path d="m100.761 68.9967v34.0033h-7.1991l-14.2326-19.8814v19.8814h-8.5839v-34.0033h8.307l13.125 18.7184v-18.7184zm28.454 21.5428c0 7.6978-5.15 13.0145-12.737 13.0145-7.532 0-12.738-5.3167-12.738-13.0145s5.206-13.0143 12.738-13.0143c7.587 0 12.737 5.3165 12.737 13.0143zm-8.529 0c0-3.4336-1.495-5.8703-4.208-5.8703-2.659 0-4.154 2.4367-4.154 5.8703s1.495 5.8149 4.154 5.8149c2.713 0 4.208-2.3813 4.208-5.8149zm13.185 3.8766v-9.5807h-3.655v-6.7564h3.655v-6.8671h8.584v6.8671h5.205v6.7564h-5.205v8.307c0 1.9383.941 2.769 2.658 2.769.941 0 1.994-.2216 2.769-.5538v7.3654c-.997.443-2.88.775-4.818.775-5.87 0-9.193-2.769-9.193-9.0819zm39.02-25.4194h9.083l12.958 34.0033h-9.027l-2.436-6.5902h-12.35l-2.381 6.5902h-8.806zm4.431 10.5222-3.489 9.5807h6.978zm17.44 11.0206c0-7.6978 5.095-13.0143 12.572-13.0143 6.701 0 10.854 3.9874 11.574 9.8023h-8.418c-.221-1.4953-1.384-2.6029-3.156-2.6029-2.437 0-3.988 2.2706-3.988 5.8149s1.551 5.7595 3.988 5.7595c1.772 0 2.935-1.0522 3.156-2.5475h8.418c-.72 5.7596-4.873 9.8025-11.574 9.8025-7.477 0-12.572-5.3167-12.572-13.0145zm25.676 0c0-7.6978 5.095-13.0143 12.572-13.0143 6.701 0 10.854 3.9874 11.574 9.8023h-8.418c-.221-1.4953-1.384-2.6029-3.156-2.6029-2.437 0-3.988 2.2706-3.988 5.8149s1.551 5.7595 3.988 5.7595c1.772 0 2.935-1.0522 3.156-2.5475h8.418c-.72 5.7596-4.873 9.8025-11.574 9.8025-7.477 0-12.572-5.3167-12.572-13.0145zm42.013 3.7658h8.031c-.887 5.7597-5.206 9.2487-11.686 9.2487-7.642 0-12.682-5.2613-12.682-13.0145 0-7.6978 5.317-13.0143 12.516-13.0143 7.643 0 11.962 5.095 11.962 12.5159v2.1598h-16.115c.277 2.9905 1.827 4.5965 4.319 4.5965 1.773 0 3.157-.7753 3.655-2.4921zm-3.821-10.0237c-2.049 0-3.433 1.2737-3.987 3.5997h7.532c-.111-2.0491-1.385-3.5997-3.545-3.5997zm23.4 16.7244v10.799h-8.694v-33.726h8.694v1.9937c1.163-1.3291 3.6-2.5475 6.148-2.5475 7.199 0 11.131 5.8703 11.131 13.0143 0 7.0886-3.932 13.0145-11.131 13.0145-2.548 0-4.985-1.219-6.148-2.548zm0-13.7893v6.5902c.665 1.3845 2.16 2.326 3.822 2.326 2.99 0 4.762-2.3814 4.762-5.5934s-1.772-5.6488-4.762-5.6488c-1.717 0-3.157.9969-3.822 2.326zm21.892 7.1994v-9.5807h-3.655v-6.7564h3.655v-6.8671h8.584v6.8671h5.206v6.7564h-5.206v8.307c0 1.9383.941 2.769 2.658 2.769.942 0 1.994-.2216 2.769-.5538v7.3654c-.997.443-2.88.775-4.818.775-5.87 0-9.193-2.769-9.193-9.0819zm39.458 8.5839h-8.363v-1.274c-.83.831-3.322 1.717-5.981 1.717-4.928 0-9.082-2.769-9.082-8.0301 0-4.818 4.154-7.9193 9.581-7.9193 2.049 0 4.486.6646 5.482 1.3845v-1.606c0-1.606-.941-2.9905-3.045-2.9905-1.606 0-2.548.7199-2.936 1.8275h-8.196c.72-4.8181 4.984-8.6393 11.408-8.6393 7.089 0 11.132 3.7659 11.132 10.2453zm-8.363-6.9779v-1.4399c-.553-1.0522-2.049-1.7167-3.655-1.7167-1.716 0-3.433.7199-3.433 2.3813 0 1.7168 1.717 2.4367 3.433 2.4367 1.606 0 3.102-.6645 3.655-1.6614zm20.742 4.9839v1.994h-8.694v-35.997h8.694v13.0697c1.163-1.3291 3.6-2.5475 6.148-2.5475 7.199 0 11.131 5.8149 11.131 13.0143s-3.932 13.0145-11.131 13.0145c-2.548 0-4.985-1.219-6.148-2.548zm0-13.7893v6.5902c.665 1.3845 2.105 2.326 3.822 2.326 2.99 0 4.762-2.3814 4.762-5.5934s-1.772-5.6488-4.762-5.6488c-1.662 0-3.157.9969-3.822 2.326zm28.759-20.2137v35.997h-8.695v-35.997zm19.172 27.3023h8.03c-.886 5.7597-5.206 9.2487-11.685 9.2487-7.643 0-12.682-5.2613-12.682-13.0145 0-7.6978 5.316-13.0143 12.516-13.0143 7.642 0 11.962 5.095 11.962 12.5159v2.1598h-16.116c.277 2.9905 1.828 4.5965 4.32 4.5965 1.772 0 3.157-.7753 3.655-2.4921zm-3.821-10.0237c-2.049 0-3.434 1.2737-3.988 3.5997h7.532c-.111-2.0491-1.384-3.5997-3.544-3.5997z" fill="#d30001"/></svg>
106
Added:
</header>
107
Added:
<article>
108
Added:
<p><strong>Your browser is not supported.</strong><br> Please upgrade your browser to continue.</p>
109
Added:
</article>
110
Added:
</main>
111
Added:
112
Added:
</body>
113
Added:
114
Added:
</html>
public/422.html
@@ -0,0 +1,114 @@
1
Added:
<!doctype html>
2
Added:
3
Added:
<html lang="en">
4
Added:
5
Added:
<head>
6
Added:
7
Added:
<title>The change you wanted was rejected (422 Unprocessable Entity)</title>
8
Added:
9
Added:
<meta charset="utf-8">
10
Added:
<meta name="viewport" content="initial-scale=1, width=device-width">
11
Added:
<meta name="robots" content="noindex, nofollow">
12
Added:
13
Added:
<style>
14
Added:
15
Added:
*, *::before, *::after {
16
Added:
box-sizing: border-box;
17
Added:
}
18
Added:
19
Added:
* {
20
Added:
margin: 0;
21
Added:
}
22
Added:
23
Added:
html {
24
Added:
font-size: 16px;
25
Added:
}
26
Added:
27
Added:
body {
28
Added:
background: #FFF;
29
Added:
color: #261B23;
30
Added:
display: grid;
31
Added:
font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, Aptos, Roboto, "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
32
Added:
font-size: clamp(1rem, 2.5vw, 2rem);
33
Added:
-webkit-font-smoothing: antialiased;
34
Added:
font-style: normal;
35
Added:
font-weight: 400;
36
Added:
letter-spacing: -0.0025em;
37
Added:
line-height: 1.4;
38
Added:
min-height: 100vh;
39
Added:
place-items: center;
40
Added:
text-rendering: optimizeLegibility;
41
Added:
-webkit-text-size-adjust: 100%;
42
Added:
}
43
Added:
44
Added:
a {
45
Added:
color: inherit;
46
Added:
font-weight: 700;
47
Added:
text-decoration: underline;
48
Added:
text-underline-offset: 0.0925em;
49
Added:
}
50
Added:
51
Added:
b, strong {
52
Added:
font-weight: 700;
53
Added:
}
54
Added:
55
Added:
i, em {
56
Added:
font-style: italic;
57
Added:
}
58
Added:
59
Added:
main {
60
Added:
display: grid;
61
Added:
gap: 1em;
62
Added:
padding: 2em;
63
Added:
place-items: center;
64
Added:
text-align: center;
65
Added:
}
66
Added:
67
Added:
main header {
68
Added:
width: min(100%, 12em);
69
Added:
}
70
Added:
71
Added:
main header svg {
72
Added:
height: auto;
73
Added:
max-width: 100%;
74
Added:
width: 100%;
75
Added:
}
76
Added:
77
Added:
main article {
78
Added:
width: min(100%, 30em);
79
Added:
}
80
Added:
81
Added:
main article p {
82
Added:
font-size: 75%;
83
Added:
}
84
Added:
85
Added:
main article br {
86
Added:
87
Added:
display: none;
88
Added:
89
Added:
@media(min-width: 48em) {
90
Added:
display: inline;
91
Added:
}
92
Added:
93
Added:
}
94
Added:
95
Added:
</style>
96
Added:
97
Added:
</head>
98
Added:
99
Added:
<body>
100
Added:
101
Added:
<!-- This file lives in public/422.html -->
102
Added:
103
Added:
<main>
104
Added:
<header>
105
Added:
<svg height="172" viewBox="0 0 480 172" width="480" xmlns="http://www.w3.org/2000/svg"><path d="m124.48 3.00509-45.6889 100.02991h26.2239v-28.1168h38.119v28.1168h21.628v35.145h-21.628v30.82h-37.308v-30.82h-72.1833v-31.901l50.2851-103.27391zm130.453 51.63681c0-8.9215-6.218-15.4099-15.681-15.4099-10.273 0-15.95 7.5698-16.491 16.4913h-44.608c3.244-30.8199 25.683-55.421707 61.099-55.421707 36.498 0 59.477 20.816907 59.477 51.636807 0 21.3577-14.869 36.7676-31.901 52.7186l-27.305 27.035h59.747v37.308h-120.306v-27.846l57.044-56.7736c11.084-11.8954 18.925-20.0059 18.925-29.7385zm140.455 0c0-8.9215-6.218-15.4099-15.68-15.4099-10.274 0-15.951 7.5698-16.492 16.4913h-44.608c3.245-30.8199 25.684-55.421707 61.1-55.421707 36.497 0 59.477 20.816907 59.477 51.636807 0 21.3577-14.87 36.7676-31.902 52.7186l-27.305 27.035h59.747v37.308h-120.305v-27.846l57.043-56.7736c11.085-11.8954 18.925-20.0059 18.925-29.7385z" fill="#f0eff0"/><path d="m19.3936 103.554c-8.9715 0-14.84183-5.0952-14.84183-14.4544v-20.1029h8.86083v19.3276c0 4.8181 2.2706 7.3102 5.981 7.3102 3.6551 0 5.9257-2.4921 5.9257-7.3102v-19.3276h8.8608v20.1583c0 9.3038-5.8149 14.399-14.7865 14.399zm18.734-.554v-24.921h8.6947v2.1598c1.3845-1.5506 3.8212-2.7136 6.701-2.7136 5.538 0 8.8054 3.5997 8.8054 9.1377v16.3371h-8.6393v-14.2327c0-2.049-1.0522-3.5443-3.2674-3.5443-1.7168 0-3.1567.9969-3.5997 2.7136v15.0634zm36.8584-1.994v10.799h-8.6946v-33.726h8.6946v1.9937c1.163-1.3291 3.5997-2.5475 6.1472-2.5475 7.1994 0 11.1314 5.8703 11.1314 13.0143 0 7.0886-3.932 13.0145-11.1314 13.0145-2.5475 0-4.9842-1.219-6.1472-2.548zm0-13.7893v6.5902c.6646 1.3845 2.1599 2.326 3.8213 2.326 2.9905 0 4.7626-2.3814 4.7626-5.5934s-1.7721-5.6488-4.7626-5.6488c-1.7168 0-3.1567.9969-3.8213 2.326zm36.789-9.2485v8.3624c-1.052-.5538-2.215-.7753-3.6-.7753-2.381 0-3.987 1.0522-4.43 2.8244v14.6203h-8.6949v-24.921h8.6949v2.2152c1.218-1.6614 3.156-2.769 5.648-2.769 1.108 0 1.994.2215 2.382.443zm26.769 12.5713c0 7.6978-5.15 13.0145-12.737 13.0145-7.532 0-12.738-5.3167-12.738-13.0145s5.206-13.0143 12.738-13.0143c7.587 0 12.737 5.3165 12.737 13.0143zm-8.528 0c0-3.4336-1.496-5.8703-4.209-5.8703-2.659 0-4.154 2.4367-4.154 5.8703s1.495 5.8149 4.154 5.8149c2.713 0 4.209-2.3813 4.209-5.8149zm10.352 0c0-7.6978 5.095-13.0143 12.571-13.0143 6.701 0 10.855 3.9874 11.574 9.8023h-8.417c-.222-1.4953-1.385-2.6029-3.157-2.6029-2.437 0-3.987 2.2706-3.987 5.8149s1.55 5.7595 3.987 5.7595c1.772 0 2.935-1.0522 3.157-2.5475h8.417c-.719 5.7596-4.873 9.8025-11.574 9.8025-7.476 0-12.571-5.3167-12.571-13.0145zm42.013 3.7658h8.03c-.886 5.7597-5.206 9.2487-11.685 9.2487-7.643 0-12.682-5.2613-12.682-13.0145 0-7.6978 5.316-13.0143 12.516-13.0143 7.642 0 11.962 5.095 11.962 12.5159v2.1598h-16.116c.277 2.9905 1.828 4.5965 4.32 4.5965 1.772 0 3.156-.7753 3.655-2.4921zm-3.821-10.0237c-2.049 0-3.434 1.2737-3.988 3.5997h7.532c-.111-2.0491-1.385-3.5997-3.544-3.5997zm13.428 11.0206h8.473c.387 1.3845 1.606 2.1598 3.156 2.1598 1.44 0 2.548-.5538 2.548-1.7168 0-.9414-.72-1.2737-1.938-1.5506l-4.874-.9969c-4.153-.886-6.867-2.8797-6.867-7.2547 0-5.3165 4.763-8.4178 10.633-8.4178 6.812 0 10.522 3.1567 11.297 8.0855h-8.03c-.277-1.0522-1.052-1.9937-3.046-1.9937-1.273 0-2.326.5538-2.326 1.6614 0 .7753.554 1.163 1.717 1.3845l4.929 1.163c4.541 1.0522 6.978 3.4335 6.978 7.4763 0 5.3168-4.818 8.2518-10.91 8.2518-6.369 0-10.965-2.88-11.74-8.2518zm24.269 0h8.474c.387 1.3845 1.606 2.1598 3.156 2.1598 1.44 0 2.548-.5538 2.548-1.7168 0-.9414-.72-1.2737-1.939-1.5506l-4.873-.9969c-4.154-.886-6.867-2.8797-6.867-7.2547 0-5.3165 4.763-8.4178 10.633-8.4178 6.812 0 10.522 3.1567 11.297 8.0855h-8.03c-.277-1.0522-1.052-1.9937-3.046-1.9937-1.273 0-2.326.5538-2.326 1.6614 0 .7753.554 1.163 1.717 1.3845l4.929 1.163c4.541 1.0522 6.978 3.4335 6.978 7.4763 0 5.3168-4.818 8.2518-10.91 8.2518-6.369 0-10.965-2.88-11.741-8.2518zm47.918 7.6978h-8.363v-1.274c-.831.831-3.323 1.717-5.981 1.717-4.929 0-9.082-2.769-9.082-8.0301 0-4.818 4.153-7.9193 9.581-7.9193 2.049 0 4.485.6646 5.482 1.3845v-1.606c0-1.606-.941-2.9905-3.046-2.9905-1.606 0-2.547.7199-2.935 1.8275h-8.196c.72-4.8181 4.984-8.6393 11.408-8.6393 7.089 0 11.132 3.7659 11.132 10.2453zm-8.363-6.9779v-1.4399c-.554-1.0522-2.049-1.7167-3.655-1.7167-1.717 0-3.434.7199-3.434 2.3813 0 1.7168 1.717 2.4367 3.434 2.4367 1.606 0 3.101-.6645 3.655-1.6614zm20.742 4.9839v1.994h-8.695v-35.997h8.695v13.0697c1.163-1.3291 3.6-2.5475 6.147-2.5475 7.2 0 11.132 5.8149 11.132 13.0143s-3.932 13.0145-11.132 13.0145c-2.547 0-4.984-1.219-6.147-2.548zm0-13.7893v6.5902c.665 1.3845 2.105 2.326 3.821 2.326 2.991 0 4.763-2.3814 4.763-5.5934s-1.772-5.6488-4.763-5.6488c-1.661 0-3.156.9969-3.821 2.326zm28.759-20.2137v35.997h-8.695v-35.997zm19.172 27.3023h8.03c-.886 5.7597-5.206 9.2487-11.685 9.2487-7.643 0-12.682-5.2613-12.682-13.0145 0-7.6978 5.316-13.0143 12.515-13.0143 7.643 0 11.962 5.095 11.962 12.5159v2.1598h-16.115c.277 2.9905 1.827 4.5965 4.32 4.5965 1.772 0 3.156-.7753 3.655-2.4921zm-3.822-10.0237c-2.049 0-3.433 1.2737-3.987 3.5997h7.532c-.111-2.0491-1.385-3.5997-3.545-3.5997zm25.461-15.2849h24.311v7.6424h-15.561v5.3165h14.232v7.4763h-14.232v5.8703h15.561v7.6978h-24.311zm27.942 34.0033v-24.921h8.694v2.1598c1.385-1.5506 3.822-2.7136 6.701-2.7136 5.538 0 8.806 3.5997 8.806 9.1377v16.3371h-8.639v-14.2327c0-2.049-1.053-3.5443-3.268-3.5443-1.717 0-3.157.9969-3.6 2.7136v15.0634zm29.991-8.5839v-9.5807h-3.655v-6.7564h3.655v-6.8671h8.584v6.8671h5.206v6.7564h-5.206v8.307c0 1.9383.941 2.769 2.658 2.769.942 0 1.994-.2216 2.769-.5538v7.3654c-.997.443-2.88.775-4.818.775-5.87 0-9.193-2.769-9.193-9.0819zm26.161-16.3371v24.921h-8.694v-24.921zm.61-6.7564c0 2.8244-2.271 4.652-4.929 4.652s-4.929-1.8276-4.929-4.652c0-2.8797 2.271-4.7073 4.929-4.7073s4.929 1.8276 4.929 4.7073zm5.382 23.0935v-9.5807h-3.655v-6.7564h3.655v-6.8671h8.584v6.8671h5.206v6.7564h-5.206v8.307c0 1.9383.941 2.769 2.658 2.769.941 0 1.994-.2216 2.769-.5538v7.3654c-.997.443-2.88.775-4.818.775-5.87 0-9.193-2.769-9.193-9.0819zm29.22 17.3889h-8.584l3.655-9.414-9.303-24.312h9.026l4.763 14.1773 4.652-14.1773h8.639z" fill="#d30001"/></svg>
106
Added:
</header>
107
Added:
<article>
108
Added:
<p><strong>The change you wanted was rejected.</strong> Maybe you tried to change something you didn’t have access to. If you’re the application owner check the logs for more information.</p>
109
Added:
</article>
110
Added:
</main>
111
Added:
112
Added:
</body>
113
Added:
114
Added:
</html>
public/500.html
@@ -0,0 +1,114 @@
1
Added:
<!doctype html>
2
Added:
3
Added:
<html lang="en">
4
Added:
5
Added:
<head>
6
Added:
7
Added:
<title>We’re sorry, but something went wrong (500 Internal Server Error)</title>
8
Added:
9
Added:
<meta charset="utf-8">
10
Added:
<meta name="viewport" content="initial-scale=1, width=device-width">
11
Added:
<meta name="robots" content="noindex, nofollow">
12
Added:
13
Added:
<style>
14
Added:
15
Added:
*, *::before, *::after {
16
Added:
box-sizing: border-box;
17
Added:
}
18
Added:
19
Added:
* {
20
Added:
margin: 0;
21
Added:
}
22
Added:
23
Added:
html {
24
Added:
font-size: 16px;
25
Added:
}
26
Added:
27
Added:
body {
28
Added:
background: #FFF;
29
Added:
color: #261B23;
30
Added:
display: grid;
31
Added:
font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, Aptos, Roboto, "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
32
Added:
font-size: clamp(1rem, 2.5vw, 2rem);
33
Added:
-webkit-font-smoothing: antialiased;
34
Added:
font-style: normal;
35
Added:
font-weight: 400;
36
Added:
letter-spacing: -0.0025em;
37
Added:
line-height: 1.4;
38
Added:
min-height: 100vh;
39
Added:
place-items: center;
40
Added:
text-rendering: optimizeLegibility;
41
Added:
-webkit-text-size-adjust: 100%;
42
Added:
}
43
Added:
44
Added:
a {
45
Added:
color: inherit;
46
Added:
font-weight: 700;
47
Added:
text-decoration: underline;
48
Added:
text-underline-offset: 0.0925em;
49
Added:
}
50
Added:
51
Added:
b, strong {
52
Added:
font-weight: 700;
53
Added:
}
54
Added:
55
Added:
i, em {
56
Added:
font-style: italic;
57
Added:
}
58
Added:
59
Added:
main {
60
Added:
display: grid;
61
Added:
gap: 1em;
62
Added:
padding: 2em;
63
Added:
place-items: center;
64
Added:
text-align: center;
65
Added:
}
66
Added:
67
Added:
main header {
68
Added:
width: min(100%, 12em);
69
Added:
}
70
Added:
71
Added:
main header svg {
72
Added:
height: auto;
73
Added:
max-width: 100%;
74
Added:
width: 100%;
75
Added:
}
76
Added:
77
Added:
main article {
78
Added:
width: min(100%, 30em);
79
Added:
}
80
Added:
81
Added:
main article p {
82
Added:
font-size: 75%;
83
Added:
}
84
Added:
85
Added:
main article br {
86
Added:
87
Added:
display: none;
88
Added:
89
Added:
@media(min-width: 48em) {
90
Added:
display: inline;
91
Added:
}
92
Added:
93
Added:
}
94
Added:
95
Added:
</style>
96
Added:
97
Added:
</head>
98
Added:
99
Added:
<body>
100
Added:
101
Added:
<!-- This file lives in public/500.html -->
102
Added:
103
Added:
<main>
104
Added:
<header>
105
Added:
<svg height="172" viewBox="0 0 480 172" width="480" xmlns="http://www.w3.org/2000/svg"><path d="m101.23 93.8427c-8.1103 0-15.4098 3.7849-19.7354 8.3813h-36.2269v-99.21891h103.8143v37.03791h-68.3984v24.8722c5.1366-2.7035 15.1396-5.9477 24.6014-5.9477 35.146 0 56.233 22.7094 56.233 55.4215 0 34.605-23.791 57.315-60.558 57.315-37.8492 0-61.64-22.169-63.8028-55.963h42.9857c1.0814 10.814 9.1919 19.195 21.6281 19.195 11.355 0 19.465-8.381 19.465-20.547 0-11.625-7.299-20.5463-20.006-20.5463zm138.833 77.8613c-40.822 0-64.884-35.146-64.884-85.7015 0-50.5554 24.062-85.700907 64.884-85.700907 40.823 0 64.884 35.145507 64.884 85.700907 0 50.5555-24.061 85.7015-64.884 85.7015zm0-133.2831c-17.572 0-22.709 21.8984-22.709 47.5816 0 25.6835 5.137 47.5815 22.709 47.5815 17.303 0 22.71-21.898 22.71-47.5815 0-25.6832-5.407-47.5816-22.71-47.5816zm140.456 133.2831c-40.823 0-64.884-35.146-64.884-85.7015 0-50.5554 24.061-85.700907 64.884-85.700907 40.822 0 64.884 35.145507 64.884 85.700907 0 50.5555-24.062 85.7015-64.884 85.7015zm0-133.2831c-17.573 0-22.71 21.8984-22.71 47.5816 0 25.6835 5.137 47.5815 22.71 47.5815 17.302 0 22.709-21.898 22.709-47.5815 0-25.6832-5.407-47.5816-22.709-47.5816z" fill="#f0eff0"/><path d="m23.1377 68.9967v34.0033h-8.9162v-34.0033zm4.3157 34.0033v-24.921h8.6947v2.1598c1.3845-1.5506 3.8212-2.7136 6.701-2.7136 5.538 0 8.8054 3.5997 8.8054 9.1377v16.3371h-8.6393v-14.2327c0-2.049-1.0522-3.5443-3.2674-3.5443-1.7168 0-3.1567.9969-3.5997 2.7136v15.0634zm29.9913-8.5839v-9.5807h-3.655v-6.7564h3.655v-6.8671h8.5839v6.8671h5.2058v6.7564h-5.2058v8.307c0 1.9383.9415 2.769 2.6583 2.769.9414 0 1.9937-.2216 2.769-.5538v7.3654c-.9969.443-2.8798.775-4.8181.775-5.8703 0-9.1931-2.769-9.1931-9.0819zm32.3666-.1108h8.0301c-.8861 5.7597-5.2057 9.2487-11.6852 9.2487-7.6424 0-12.682-5.2613-12.682-13.0145 0-7.6978 5.3165-13.0143 12.5159-13.0143 7.6424 0 11.9621 5.095 11.9621 12.5159v2.1598h-16.1156c.2769 2.9905 1.8275 4.5965 4.3196 4.5965 1.7722 0 3.1567-.7753 3.6551-2.4921zm-3.8212-10.0237c-2.0491 0-3.4336 1.2737-3.9874 3.5997h7.5317c-.1107-2.0491-1.3845-3.5997-3.5443-3.5997zm31.4299-6.3134v8.3624c-1.052-.5538-2.215-.7753-3.599-.7753-2.382 0-3.988 1.0522-4.431 2.8244v14.6203h-8.694v-24.921h8.694v2.2152c1.219-1.6614 3.157-2.769 5.649-2.769 1.108 0 1.994.2215 2.381.443zm2.949 25.0318v-24.921h8.694v2.1598c1.385-1.5506 3.821-2.7136 6.701-2.7136 5.538 0 8.806 3.5997 8.806 9.1377v16.3371h-8.64v-14.2327c0-2.049-1.052-3.5443-3.267-3.5443-1.717 0-3.157.9969-3.6 2.7136v15.0634zm50.371 0h-8.363v-1.274c-.83.831-3.323 1.717-5.981 1.717-4.929 0-9.082-2.769-9.082-8.0301 0-4.818 4.153-7.9193 9.581-7.9193 2.049 0 4.485.6646 5.482 1.3845v-1.606c0-1.606-.941-2.9905-3.046-2.9905-1.606 0-2.547.7199-2.935 1.8275h-8.196c.72-4.8181 4.984-8.6393 11.408-8.6393 7.089 0 11.132 3.7659 11.132 10.2453zm-8.363-6.9779v-1.4399c-.554-1.0522-2.049-1.7167-3.655-1.7167-1.717 0-3.433.7199-3.433 2.3813 0 1.7168 1.716 2.4367 3.433 2.4367 1.606 0 3.101-.6645 3.655-1.6614zm20.742-29.0191v35.997h-8.694v-35.997zm13.036 25.9178h9.248c.72 2.326 2.714 3.489 5.483 3.489 2.713 0 4.596-1.163 4.596-3.2674 0-1.6061-1.052-2.326-3.212-2.8244l-6.534-1.3845c-4.985-1.1076-8.751-3.7105-8.751-9.47 0-6.6456 5.538-11.0206 13.07-11.0206 8.307 0 13.014 4.5411 13.956 10.4114h-8.695c-.72-1.8829-2.27-3.3228-5.205-3.3228-2.548 0-4.265 1.1076-4.265 2.9905 0 1.4953 1.052 2.326 2.825 2.7137l6.645 1.5506c5.815 1.3845 9.027 4.5412 9.027 9.8023 0 6.9778-5.87 10.9654-13.291 10.9654-8.141 0-13.679-3.9322-14.897-10.6332zm46.509 1.3845h8.031c-.887 5.7597-5.206 9.2487-11.686 9.2487-7.642 0-12.682-5.2613-12.682-13.0145 0-7.6978 5.317-13.0143 12.516-13.0143 7.643 0 11.962 5.095 11.962 12.5159v2.1598h-16.115c.277 2.9905 1.827 4.5965 4.319 4.5965 1.773 0 3.157-.7753 3.655-2.4921zm-3.821-10.0237c-2.049 0-3.433 1.2737-3.987 3.5997h7.532c-.111-2.0491-1.385-3.5997-3.545-3.5997zm31.431-6.3134v8.3624c-1.053-.5538-2.216-.7753-3.6-.7753-2.381 0-3.988 1.0522-4.431 2.8244v14.6203h-8.694v-24.921h8.694v2.2152c1.219-1.6614 3.157-2.769 5.649-2.769 1.108 0 1.994.2215 2.382.443zm18.288 25.0318h-7.809l-9.47-24.921h8.861l4.763 14.288 4.652-14.288h8.528zm25.614-8.6947h8.03c-.886 5.7597-5.206 9.2487-11.685 9.2487-7.642 0-12.682-5.2613-12.682-13.0145 0-7.6978 5.316-13.0143 12.516-13.0143 7.642 0 11.962 5.095 11.962 12.5159v2.1598h-16.116c.277 2.9905 1.828 4.5965 4.32 4.5965 1.772 0 3.157-.7753 3.655-2.4921zm-3.821-10.0237c-2.049 0-3.434 1.2737-3.988 3.5997h7.532c-.111-2.0491-1.384-3.5997-3.544-3.5997zm31.43-6.3134v8.3624c-1.052-.5538-2.215-.7753-3.6-.7753-2.381 0-3.987 1.0522-4.43 2.8244v14.6203h-8.695v-24.921h8.695v2.2152c1.218-1.6614 3.157-2.769 5.649-2.769 1.107 0 1.993.2215 2.381.443zm13.703-8.9715h24.312v7.6424h-15.562v5.3165h14.232v7.4763h-14.232v5.8703h15.562v7.6978h-24.312zm44.667 8.9715v8.3624c-1.052-.5538-2.215-.7753-3.6-.7753-2.381 0-3.987 1.0522-4.43 2.8244v14.6203h-8.695v-24.921h8.695v2.2152c1.218-1.6614 3.156-2.769 5.648-2.769 1.108 0 1.994.2215 2.382.443zm19.673 0v8.3624c-1.053-.5538-2.216-.7753-3.6-.7753-2.381 0-3.987 1.0522-4.43 2.8244v14.6203h-8.695v-24.921h8.695v2.2152c1.218-1.6614 3.156-2.769 5.648-2.769 1.108 0 1.994.2215 2.382.443zm26.769 12.5713c0 7.6978-5.15 13.0145-12.737 13.0145-7.532 0-12.738-5.3167-12.738-13.0145s5.206-13.0143 12.738-13.0143c7.587 0 12.737 5.3165 12.737 13.0143zm-8.529 0c0-3.4336-1.495-5.8703-4.208-5.8703-2.659 0-4.154 2.4367-4.154 5.8703s1.495 5.8149 4.154 5.8149c2.713 0 4.208-2.3813 4.208-5.8149zm28.082-12.5713v8.3624c-1.052-.5538-2.215-.7753-3.6-.7753-2.381 0-3.987 1.0522-4.43 2.8244v14.6203h-8.695v-24.921h8.695v2.2152c1.218-1.6614 3.157-2.769 5.649-2.769 1.107 0 1.993.2215 2.381.443z" fill="#d30001"/></svg>
106
Added:
</header>
107
Added:
<article>
108
Added:
<p><strong>We’re sorry, but something went wrong.</strong><br> If you’re the application owner check the logs for more information.</p>
109
Added:
</article>
110
Added:
</main>
111
Added:
112
Added:
</body>
113
Added:
114
Added:
</html>
public/icon.png
Binary files differ
public/icon.svg
@@ -0,0 +1,3 @@
1
Added:
<svg width="512" height="512" xmlns="http://www.w3.org/2000/svg">
2
Added:
<circle cx="256" cy="256" r="256" fill="red"/>
3
Added:
</svg>
public/robots.txt
@@ -0,0 +1,1 @@
1
Added:
# See https://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file
script/.keep
storage/.keep
test/application_system_test_case.rb
@@ -0,0 +1,5 @@
1
Added:
require "test_helper"
2
Added:
3
Added:
class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
4
Added:
driven_by :selenium, using: :headless_chrome, screen_size: [ 1400, 1400 ]
5
Added:
end
test/controllers/crops_controller_test.rb
@@ -0,0 +1,48 @@
1
Added:
require "test_helper"
2
Added:
3
Added:
class CropsControllerTest < ActionDispatch::IntegrationTest
4
Added:
setup do
5
Added:
@crop = crops(:one)
6
Added:
end
7
Added:
8
Added:
test "should get index" do
9
Added:
get crops_url
10
Added:
assert_response :success
11
Added:
end
12
Added:
13
Added:
test "should get new" do
14
Added:
get new_crop_url
15
Added:
assert_response :success
16
Added:
end
17
Added:
18
Added:
test "should create crop" do
19
Added:
assert_difference("Crop.count") do
20
Added:
post crops_url, params: { crop: { b: @crop.b, ca: @crop.ca, cl: @crop.cl, crop_type: @crop.crop_type, cu: @crop.cu, fe: @crop.fe, k: @crop.k, mg: @crop.mg, mn: @crop.mn, mo: @crop.mo, na: @crop.na, name: @crop.name, nnh4: @crop.nnh4, nno3: @crop.nno3, p: @crop.p, s: @crop.s, si: @crop.si, zn: @crop.zn } }
21
Added:
end
22
Added:
23
Added:
assert_redirected_to crop_url(Crop.last)
24
Added:
end
25
Added:
26
Added:
test "should show crop" do
27
Added:
get crop_url(@crop)
28
Added:
assert_response :success
29
Added:
end
30
Added:
31
Added:
test "should get edit" do
32
Added:
get edit_crop_url(@crop)
33
Added:
assert_response :success
34
Added:
end
35
Added:
36
Added:
test "should update crop" do
37
Added:
patch crop_url(@crop), params: { crop: { b: @crop.b, ca: @crop.ca, cl: @crop.cl, crop_type: @crop.crop_type, cu: @crop.cu, fe: @crop.fe, k: @crop.k, mg: @crop.mg, mn: @crop.mn, mo: @crop.mo, na: @crop.na, name: @crop.name, nnh4: @crop.nnh4, nno3: @crop.nno3, p: @crop.p, s: @crop.s, si: @crop.si, zn: @crop.zn } }
38
Added:
assert_redirected_to crop_url(@crop)
39
Added:
end
40
Added:
41
Added:
test "should destroy crop" do
42
Added:
assert_difference("Crop.count", -1) do
43
Added:
delete crop_url(@crop)
44
Added:
end
45
Added:
46
Added:
assert_redirected_to crops_url
47
Added:
end
48
Added:
end
test/controllers/dashboard_controller_test.rb
@@ -0,0 +1,8 @@
1
Added:
require "test_helper"
2
Added:
3
Added:
class DashboardControllerTest < ActionDispatch::IntegrationTest
4
Added:
test "should get index" do
5
Added:
get dashboard_index_url
6
Added:
assert_response :success
7
Added:
end
8
Added:
end
test/controllers/fertilizer_products_controller_test.rb
@@ -0,0 +1,48 @@
1
Added:
require "test_helper"
2
Added:
3
Added:
class FertilizerProductsControllerTest < ActionDispatch::IntegrationTest
4
Added:
setup do
5
Added:
@fertilizer_product = fertilizer_products(:one)
6
Added:
end
7
Added:
8
Added:
test "should get index" do
9
Added:
get fertilizer_products_url
10
Added:
assert_response :success
11
Added:
end
12
Added:
13
Added:
test "should get new" do
14
Added:
get new_fertilizer_product_url
15
Added:
assert_response :success
16
Added:
end
17
Added:
18
Added:
test "should create fertilizer_product" do
19
Added:
assert_difference("FertilizerProduct.count") do
20
Added:
post fertilizer_products_url, params: { fertilizer_product: { name: @fertilizer_product.name, purity: @fertilizer_product.purity } }
21
Added:
end
22
Added:
23
Added:
assert_redirected_to fertilizer_product_url(FertilizerProduct.last)
24
Added:
end
25
Added:
26
Added:
test "should show fertilizer_product" do
27
Added:
get fertilizer_product_url(@fertilizer_product)
28
Added:
assert_response :success
29
Added:
end
30
Added:
31
Added:
test "should get edit" do
32
Added:
get edit_fertilizer_product_url(@fertilizer_product)
33
Added:
assert_response :success
34
Added:
end
35
Added:
36
Added:
test "should update fertilizer_product" do
37
Added:
patch fertilizer_product_url(@fertilizer_product), params: { fertilizer_product: { name: @fertilizer_product.name, purity: @fertilizer_product.purity } }
38
Added:
assert_redirected_to fertilizer_product_url(@fertilizer_product)
39
Added:
end
40
Added:
41
Added:
test "should destroy fertilizer_product" do
42
Added:
assert_difference("FertilizerProduct.count", -1) do
43
Added:
delete fertilizer_product_url(@fertilizer_product)
44
Added:
end
45
Added:
46
Added:
assert_redirected_to fertilizer_products_url
47
Added:
end
48
Added:
end
test/controllers/nutrient_measurement_controller_test.rb
@@ -0,0 +1,8 @@
1
Added:
require "test_helper"
2
Added:
3
Added:
class NutrientMeasurementControllerTest < ActionDispatch::IntegrationTest
4
Added:
test "should get index" do
5
Added:
get nutrient_measurement_index_url
6
Added:
assert_response :success
7
Added:
end
8
Added:
end
test/controllers/rafts_controller_test.rb
@@ -0,0 +1,7 @@
1
Added:
require "test_helper"
2
Added:
3
Added:
class RaftsControllerTest < ActionDispatch::IntegrationTest
4
Added:
# test "the truth" do
5
Added:
# assert true
6
Added:
# end
7
Added:
end
test/controllers/recipes_controller_test.rb
@@ -0,0 +1,7 @@
1
Added:
require "test_helper"
2
Added:
3
Added:
class RecipesControllerTest < ActionDispatch::IntegrationTest
4
Added:
# test "the truth" do
5
Added:
# assert true
6
Added:
# end
7
Added:
end
test/fixtures/beds.yml
@@ -0,0 +1,7 @@
1
Added:
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
2
Added:
3
Added:
one:
4
Added:
number: 1
5
Added:
6
Added:
two:
7
Added:
number: 1
test/fixtures/crops.yml
@@ -0,0 +1,41 @@
1
Added:
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
2
Added:
3
Added:
one:
4
Added:
name: MyString
5
Added:
crop_type: 1
6
Added:
nno3: 1.5
7
Added:
p: 1.5
8
Added:
k: 1.5
9
Added:
ca: 1.5
10
Added:
mg: 1.5
11
Added:
s: 1.5
12
Added:
na: 1.5
13
Added:
cl: 1.5
14
Added:
si: 1.5
15
Added:
fe: 1.5
16
Added:
zn: 1.5
17
Added:
b: 1.5
18
Added:
mn: 1.5
19
Added:
cu: 1.5
20
Added:
mo: 1.5
21
Added:
nnh4: 1.5
22
Added:
23
Added:
two:
24
Added:
name: MyString
25
Added:
crop_type: 1
26
Added:
nno3: 1.5
27
Added:
p: 1.5
28
Added:
k: 1.5
29
Added:
ca: 1.5
30
Added:
mg: 1.5
31
Added:
s: 1.5
32
Added:
na: 1.5
33
Added:
cl: 1.5
34
Added:
si: 1.5
35
Added:
fe: 1.5
36
Added:
zn: 1.5
37
Added:
b: 1.5
38
Added:
mn: 1.5
39
Added:
cu: 1.5
40
Added:
mo: 1.5
41
Added:
nnh4: 1.5
test/fixtures/fertilizer_products.yml
@@ -0,0 +1,9 @@
1
Added:
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
2
Added:
3
Added:
one:
4
Added:
name: MyString
5
Added:
purity: 9.99
6
Added:
7
Added:
two:
8
Added:
name: MyString
9
Added:
purity: 9.99
test/fixtures/files/.keep
test/fixtures/nutrient_measurements.yml
@@ -0,0 +1,39 @@
1
Added:
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
2
Added:
3
Added:
one:
4
Added:
measured_on: 2025-08-20
5
Added:
nno3: 1.5
6
Added:
p: 1.5
7
Added:
k: 1.5
8
Added:
ca: 1.5
9
Added:
mg: 1.5
10
Added:
s: 1.5
11
Added:
na: 1.5
12
Added:
cl: 1.5
13
Added:
si: 1.5
14
Added:
fe: 1.5
15
Added:
zn: 1.5
16
Added:
b: 1.5
17
Added:
mn: 1.5
18
Added:
cu: 1.5
19
Added:
mo: 1.5
20
Added:
nnh4: 1.5
21
Added:
22
Added:
two:
23
Added:
measured_on: 2025-08-20
24
Added:
nno3: 1.5
25
Added:
p: 1.5
26
Added:
k: 1.5
27
Added:
ca: 1.5
28
Added:
mg: 1.5
29
Added:
s: 1.5
30
Added:
na: 1.5
31
Added:
cl: 1.5
32
Added:
si: 1.5
33
Added:
fe: 1.5
34
Added:
zn: 1.5
35
Added:
b: 1.5
36
Added:
mn: 1.5
37
Added:
cu: 1.5
38
Added:
mo: 1.5
39
Added:
nnh4: 1.5
test/fixtures/nutrients.yml
@@ -0,0 +1,9 @@
1
Added:
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
2
Added:
3
Added:
one:
4
Added:
formula: MyString
5
Added:
name: MyString
6
Added:
7
Added:
two:
8
Added:
formula: MyString
9
Added:
name: MyString
test/fixtures/rafts.yml
@@ -0,0 +1,9 @@
1
Added:
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
2
Added:
3
Added:
one:
4
Added:
bed: one
5
Added:
location: 1
6
Added:
7
Added:
two:
8
Added:
bed: two
9
Added:
location: 1
test/helpers/.keep
test/integration/.keep
test/mailers/.keep
test/models/.keep
test/models/bed_test.rb
@@ -0,0 +1,7 @@
1
Added:
require "test_helper"
2
Added:
3
Added:
class BedTest < ActiveSupport::TestCase
4
Added:
# test "the truth" do
5
Added:
# assert true
6
Added:
# end
7
Added:
end
test/models/crop_test.rb
@@ -0,0 +1,7 @@
1
Added:
require "test_helper"
2
Added:
3
Added:
class CropTest < ActiveSupport::TestCase
4
Added:
# test "the truth" do
5
Added:
# assert true
6
Added:
# end
7
Added:
end
test/models/fertilizer_composition_test.rb
@@ -0,0 +1,7 @@
1
Added:
require "test_helper"
2
Added:
3
Added:
class FertilizerCompositionTest < ActiveSupport::TestCase
4
Added:
# test "the truth" do
5
Added:
# assert true
6
Added:
# end
7
Added:
end
test/models/fertilizer_product_test.rb
@@ -0,0 +1,7 @@
1
Added:
require "test_helper"
2
Added:
3
Added:
class FertilizerProductTest < ActiveSupport::TestCase
4
Added:
# test "the truth" do
5
Added:
# assert true
6
Added:
# end
7
Added:
end
test/models/fertilizer_test.rb
@@ -0,0 +1,7 @@
1
Added:
require "test_helper"
2
Added:
3
Added:
class FertilizerTest < ActiveSupport::TestCase
4
Added:
# test "the truth" do
5
Added:
# assert true
6
Added:
# end
7
Added:
end
test/models/nutrient_measurement_test.rb
@@ -0,0 +1,7 @@
1
Added:
require "test_helper"
2
Added:
3
Added:
class NutrientMeasurementTest < ActiveSupport::TestCase
4
Added:
# test "the truth" do
5
Added:
# assert true
6
Added:
# end
7
Added:
end
test/models/nutrient_test.rb
@@ -0,0 +1,7 @@
1
Added:
require "test_helper"
2
Added:
3
Added:
class NutrientTest < ActiveSupport::TestCase
4
Added:
# test "the truth" do
5
Added:
# assert true
6
Added:
# end
7
Added:
end
test/models/raft_test.rb
@@ -0,0 +1,7 @@
1
Added:
require "test_helper"
2
Added:
3
Added:
class RaftTest < ActiveSupport::TestCase
4
Added:
# test "the truth" do
5
Added:
# assert true
6
Added:
# end
7
Added:
end
test/system/.keep
test/system/crops_test.rb
@@ -0,0 +1,75 @@
1
Added:
require "application_system_test_case"
2
Added:
3
Added:
class CropsTest < ApplicationSystemTestCase
4
Added:
setup do
5
Added:
@crop = crops(:one)
6
Added:
end
7
Added:
8
Added:
test "visiting the index" do
9
Added:
visit crops_url
10
Added:
assert_selector "h1", text: "Crops"
11
Added:
end
12
Added:
13
Added:
test "should create crop" do
14
Added:
visit crops_url
15
Added:
click_on "New crop"
16
Added:
17
Added:
fill_in "B", with: @crop.b
18
Added:
fill_in "Ca", with: @crop.ca
19
Added:
fill_in "Cl", with: @crop.cl
20
Added:
fill_in "Crop type", with: @crop.crop_type
21
Added:
fill_in "Cu", with: @crop.cu
22
Added:
fill_in "Fe", with: @crop.fe
23
Added:
fill_in "K", with: @crop.k
24
Added:
fill_in "Mg", with: @crop.mg
25
Added:
fill_in "Mn", with: @crop.mn
26
Added:
fill_in "Mo", with: @crop.mo
27
Added:
fill_in "Na", with: @crop.na
28
Added:
fill_in "Name", with: @crop.name
29
Added:
fill_in "Nnh4", with: @crop.nnh4
30
Added:
fill_in "Nno3", with: @crop.nno3
31
Added:
fill_in "P", with: @crop.p
32
Added:
fill_in "S", with: @crop.s
33
Added:
fill_in "Si", with: @crop.si
34
Added:
fill_in "Zn", with: @crop.zn
35
Added:
click_on "Create Crop"
36
Added:
37
Added:
assert_text "Crop was successfully created"
38
Added:
click_on "Back"
39
Added:
end
40
Added:
41
Added:
test "should update Crop" do
42
Added:
visit crop_url(@crop)
43
Added:
click_on "Edit this crop", match: :first
44
Added:
45
Added:
fill_in "B", with: @crop.b
46
Added:
fill_in "Ca", with: @crop.ca
47
Added:
fill_in "Cl", with: @crop.cl
48
Added:
fill_in "Crop type", with: @crop.crop_type
49
Added:
fill_in "Cu", with: @crop.cu
50
Added:
fill_in "Fe", with: @crop.fe
51
Added:
fill_in "K", with: @crop.k
52
Added:
fill_in "Mg", with: @crop.mg
53
Added:
fill_in "Mn", with: @crop.mn
54
Added:
fill_in "Mo", with: @crop.mo
55
Added:
fill_in "Na", with: @crop.na
56
Added:
fill_in "Name", with: @crop.name
57
Added:
fill_in "Nnh4", with: @crop.nnh4
58
Added:
fill_in "Nno3", with: @crop.nno3
59
Added:
fill_in "P", with: @crop.p
60
Added:
fill_in "S", with: @crop.s
61
Added:
fill_in "Si", with: @crop.si
62
Added:
fill_in "Zn", with: @crop.zn
63
Added:
click_on "Update Crop"
64
Added:
65
Added:
assert_text "Crop was successfully updated"
66
Added:
click_on "Back"
67
Added:
end
68
Added:
69
Added:
test "should destroy Crop" do
70
Added:
visit crop_url(@crop)
71
Added:
click_on "Destroy this crop", match: :first
72
Added:
73
Added:
assert_text "Crop was successfully destroyed"
74
Added:
end
75
Added:
end
test/system/fertilizer_products_test.rb
@@ -0,0 +1,43 @@
1
Added:
require "application_system_test_case"
2
Added:
3
Added:
class FertilizerProductsTest < ApplicationSystemTestCase
4
Added:
setup do
5
Added:
@fertilizer_product = fertilizer_products(:one)
6
Added:
end
7
Added:
8
Added:
test "visiting the index" do
9
Added:
visit fertilizer_products_url
10
Added:
assert_selector "h1", text: "Fertilizer products"
11
Added:
end
12
Added:
13
Added:
test "should create fertilizer product" do
14
Added:
visit fertilizer_products_url
15
Added:
click_on "New fertilizer product"
16
Added:
17
Added:
fill_in "Name", with: @fertilizer_product.name
18
Added:
fill_in "Purity", with: @fertilizer_product.purity
19
Added:
click_on "Create Fertilizer product"
20
Added:
21
Added:
assert_text "Fertilizer product was successfully created"
22
Added:
click_on "Back"
23
Added:
end
24
Added:
25
Added:
test "should update Fertilizer product" do
26
Added:
visit fertilizer_product_url(@fertilizer_product)
27
Added:
click_on "Edit this fertilizer product", match: :first
28
Added:
29
Added:
fill_in "Name", with: @fertilizer_product.name
30
Added:
fill_in "Purity", with: @fertilizer_product.purity
31
Added:
click_on "Update Fertilizer product"
32
Added:
33
Added:
assert_text "Fertilizer product was successfully updated"
34
Added:
click_on "Back"
35
Added:
end
36
Added:
37
Added:
test "should destroy Fertilizer product" do
38
Added:
visit fertilizer_product_url(@fertilizer_product)
39
Added:
click_on "Destroy this fertilizer product", match: :first
40
Added:
41
Added:
assert_text "Fertilizer product was successfully destroyed"
42
Added:
end
43
Added:
end
test/test_helper.rb
@@ -0,0 +1,15 @@
1
Added:
ENV["RAILS_ENV"] ||= "test"
2
Added:
require_relative "../config/environment"
3
Added:
require "rails/test_help"
4
Added:
5
Added:
module ActiveSupport
6
Added:
class TestCase
7
Added:
# Run tests in parallel with specified workers
8
Added:
parallelize(workers: :number_of_processors)
9
Added:
10
Added:
# Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
11
Added:
fixtures :all
12
Added:
13
Added:
# Add more helper methods to be used by all tests here...
14
Added:
end
15
Added:
end
tmp/.keep
tmp/pids/.keep
tmp/storage/.keep
vendor/.gitignore
@@ -0,0 +1,3 @@
1
Added:
/bundle/*
2
Added:
!/bundle/
3
Added:
!/bundle/.keep