Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci-features-admin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ jobs:
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Setup yarn cache
uses: actions/cache@v5
uses: actions/cache@v6
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-features-comments.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ jobs:
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Setup yarn cache
uses: actions/cache@v5
uses: actions/cache@v6
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-features-conversations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ jobs:
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Setup yarn cache
uses: actions/cache@v5
uses: actions/cache@v6
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-features-crops.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ jobs:
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Setup yarn cache
uses: actions/cache@v5
uses: actions/cache@v6
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-features-gardens.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ jobs:
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Setup yarn cache
uses: actions/cache@v5
uses: actions/cache@v6
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-features-harvests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ jobs:
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Setup yarn cache
uses: actions/cache@v5
uses: actions/cache@v6
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-features-home.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ jobs:
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Setup yarn cache
uses: actions/cache@v5
uses: actions/cache@v6
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-features-members.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ jobs:
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Setup yarn cache
uses: actions/cache@v5
uses: actions/cache@v6
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-features-places.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ jobs:
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Setup yarn cache
uses: actions/cache@v5
uses: actions/cache@v6
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-features-plantings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ jobs:
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Setup yarn cache
uses: actions/cache@v5
uses: actions/cache@v6
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-features-posts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ jobs:
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Setup yarn cache
uses: actions/cache@v5
uses: actions/cache@v6
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-features-seeds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ jobs:
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Setup yarn cache
uses: actions/cache@v5
uses: actions/cache@v6
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-features-timeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ jobs:
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Setup yarn cache
uses: actions/cache@v5
uses: actions/cache@v6
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-features.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ jobs:
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Setup yarn cache
uses: actions/cache@v5
uses: actions/cache@v6
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ jobs:
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Setup yarn cache
uses: actions/cache@v5
uses: actions/cache@v6
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
Expand Down
30 changes: 5 additions & 25 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -138,22 +138,12 @@ GEM
aws-sigv4 (~> 1.5)
aws-sigv4 (1.12.1)
aws-eventstream (~> 1, >= 1.0.2)
axe-core-api (4.11.3)
axe-core-api (4.12.0)
dumb_delegator
ostruct
virtus
axe-core-capybara (4.11.3)
axe-core-api (= 4.11.3)
dumb_delegator
axe-core-rspec (4.11.3)
axe-core-api (= 4.11.3)
dumb_delegator
ostruct
virtus
axiom-types (0.1.1)
descendants_tracker (~> 0.0.4)
ice_nine (~> 0.11.0)
thread_safe (~> 0.3, >= 0.3.1)
axe-core-capybara (4.12.0)
axe-core-api (= 4.12.0)
axe-core-rspec (4.12.0)
axe-core-api (= 4.12.0)
base64 (0.3.0)
bcrypt (3.1.22)
benchmark (0.5.0)
Expand Down Expand Up @@ -207,8 +197,6 @@ GEM
childprocess (5.1.0)
logger (~> 1.5)
coderay (1.1.3)
coercible (1.0.0)
descendants_tracker (~> 0.0.1)
coffee-rails (5.0.0)
coffee-script (>= 2.2.0)
railties (>= 5.2.0)
Expand Down Expand Up @@ -242,8 +230,6 @@ GEM
database_cleaner-core (~> 2.0.0)
database_cleaner-core (2.0.1)
date (3.5.1)
descendants_tracker (0.0.4)
thread_safe (~> 0.3, >= 0.3.1)
devise (5.0.4)
bcrypt (~> 3.0)
orm_adapter (~> 0.1)
Expand Down Expand Up @@ -358,7 +344,6 @@ GEM
logger
ostruct
ice_cube (0.17.0)
ice_nine (0.11.2)
image_processing (1.12.2)
mini_magick (>= 4.9.5, < 5)
ruby-vips (>= 2.0.17, < 3)
Expand Down Expand Up @@ -721,7 +706,6 @@ GEM
terser (1.2.7)
execjs (>= 0.3.0, < 3)
thor (1.5.0)
thread_safe (0.3.6)
tilt (2.7.0)
timecop (0.9.11)
timeout (0.6.1)
Expand All @@ -741,10 +725,6 @@ GEM
activemodel (>= 3.0.0)
public_suffix
vcr (6.4.0)
virtus (2.0.0)
axiom-types (~> 0.1)
coercible (~> 1.0)
descendants_tracker (~> 0.0, >= 0.0.3)
warden (1.2.9)
rack (>= 2.0.9)
webrat (0.7.3)
Expand Down
17 changes: 8 additions & 9 deletions app/controllers/harvests_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,26 @@ class HarvestsController < DataController
after_action :update_crop_medians, only: %i(create update destroy)

def index
where = {}
@harvests = Harvest.all

if params[:member_slug].present?
@owner = Member.find_by!(slug: params[:member_slug])
where['owner_id'] = @owner.id
@harvests = @harvests.where(owner_id: @owner.id)
end

if params[:crop_slug]
@crop = Crop.find_by(slug: params[:crop_slug])
where['crop_id'] = @crop.id
@harvests = @harvests.where(crop_id: @crop.id) if @crop
end

if params[:planting_slug]
@planting = Planting.find_by(slug: params[:planting_slug])
where['planting_id'] = @planting.id
@harvests = @harvests.where(planting_id: @planting.id) if @planting
end

@harvests = Harvest.search('*', where:,
limit: 100,
page: params[:page],
load: (request.format.csv? ? { include: %i(crop owner plant_part) } : false),
boost_by: [:created_at])
@harvests = @harvests.includes(:crop, :owner, :plant_part)

@harvests = @harvests.recent.paginate(page: params[:page], per_page: 100)

@filename = csv_filename

Expand Down
9 changes: 3 additions & 6 deletions app/controllers/members_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,9 @@ def show
end
end

@harvests = Harvest.search(
where: { owner_id: @member.id },
boost_by: [:created_at],
limit: 16,
load: false
)
@harvests = Harvest.where(owner_id: @member.id)
.recent
.limit(16)

respond_to do |format|
format.html # show.html.haml
Expand Down
24 changes: 4 additions & 20 deletions app/controllers/plantings_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,34 +8,18 @@ class PlantingsController < DataController
def index
@show_all = params[:all] == '1'

where = {}
where['active'] = true unless @show_all
@owner = Member.find_by!(slug: params[:member_slug]) if params[:member_slug].present?
@crop = Crop.find_by(slug: params[:crop_slug]) if params[:crop_slug]

if params[:member_slug].present?
@owner = Member.find_by!(slug: params[:member_slug])
where['owner_id'] = @owner.id
end

if params[:crop_slug]
@crop = Crop.find_by(slug: params[:crop_slug])
where['crop_id'] = @crop.id unless @crop.nil?
end

@plantings = Planting.search(
where:,
page: params[:page],
limit: 30,
boost_by: [:created_at],
load: false
)
@plantings = plantings

@filename = "Growstuff-#{specifics}Plantings-#{Time.zone.now.to_fs(:number)}.csv"
respond_with(@plantings)
end

def show
@photos = @planting.photos.includes(:owner).order(date_taken: :desc)
@harvests = Harvest.search(where: { planting_id: @planting.id })
@harvests = Harvest.where(planting_id: @planting.id).recent
@current_activities = @planting.activities.current.includes(:owner).order(created_at: :desc)
@finished_activities = @planting.activities.finished.includes(:owner).order(created_at: :desc)
@matching_seeds = matching_seeds
Expand Down
22 changes: 9 additions & 13 deletions app/controllers/seeds_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,32 @@

class SeedsController < DataController
def index
where = {}
@seeds = Seed.all

if params[:member_slug].present?
@owner = Member.find_by!(slug: params[:member_slug])
where['owner_id'] = @owner.id
@seeds = @seeds.where(owner_id: @owner.id)
end

if params[:crop_slug].present?
@crop = Crop.find_by(slug: params[:crop_slug])
where['crop_id'] = @crop.id
@seeds = @seeds.where(crop_id: @crop.id) if @crop
end

if params[:planting_id].present?
@planting = Planting.find_by(slug: params[:planting_id])
where['parent_planting'] = @planting.id
@seeds = @seeds.where(parent_planting_id: @planting.id) if @planting
end

where['tradeable_to'] = params[:tradeable_to] if params[:tradeable_to].present?
@seeds = @seeds.where(tradable_to: params[:tradeable_to]) if params[:tradeable_to].present?

@show_all = (params[:all] == '1')
where['finished'] = false unless @show_all
@seeds = @seeds.current unless @show_all

@filename = csv_filename
@seeds = Seed.search(
where:,
page: params[:page],
limit: 30,
boost_by: [:created_at],
load: (request.format.csv? ? { include: %i(crop owner) } : false)
)
@seeds = @seeds.includes(:crop, :owner)
.order(created_at: :desc)
.paginate(page: params[:page], per_page: 30)

respond_with(@seeds)
end
Expand Down
Loading
Loading