• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

benwbrum / fromthepage / 18198125262

02 Oct 2025 03:43PM UTC coverage: 65.028%. Remained the same
18198125262

push

github

web-flow
Rubocop lint remove array whitespaces (#4950)

1848 of 3359 branches covered (55.02%)

Branch coverage included in aggregate %.

154 of 201 new or added lines in 62 files covered. (76.62%)

8087 of 11919 relevant lines covered (67.85%)

109.57 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/app/controllers/quality_samplings_controller.rb
1
class QualitySamplingsController < ApplicationController
×
NEW
2
  before_action :set_quality_sampling, only: [:show, :edit, :update, :destroy, :review]
×
3
  before_action :authorized?
×
4

5

6

7
  # GET /quality_samplings
8
  def index
×
9
    # do we have a sampling?
10
    if @collection.quality_sampling.present?
×
11
      redirect_to collection_quality_sampling_path(@collection.owner, @collection, @collection.quality_sampling)
×
12
    end
×
13
  end
×
14

15
  # GET /quality_samplings/1
16
  def show
×
17
    old_set_size = @quality_sampling.sample_set.size
×
18
    @quality_sampling.calculate_set
×
19
    new_set_size = @quality_sampling.sample_set.size
×
20
    if new_set_size > old_set_size
×
21
      @quality_sampling.save!
×
22
      flash[:notice] = t('.sample_set_has_increased', increase: (new_set_size - old_set_size))
×
23
    end
×
24

25
    @work_samplings, @user_samplings = @quality_sampling.sampling_objects
×
26
    # TODO sometimes work_samplings returns bad data -- why?
27
    @works = Work.where(id: @work_samplings.keys).sort { |a, b| a.id <=> b.id }
×
28
    @users = User.where(id: @user_samplings.keys).sort { |a, b| a.id <=> b.id }
×
29
    @max_approval_delta = @quality_sampling.max_approval_delta
×
30
  end
×
31

32

33
  def review
×
34
    redirect_to collection_sampling_review_page_path(@collection.owner, @collection, @quality_sampling, @quality_sampling.next_unsampled_page, flow: 'quality-sampling')
×
35
  end
×
36

37
  def initialize_sample
×
38
    @quality_sampling = QualitySampling.new
×
39
    @quality_sampling.collection = @collection
×
40
    @quality_sampling.user = current_user
×
41

42
    if @quality_sampling.save
×
43
      # redirect_to collection_quality_sampling_path(@collection.owner, @collection, @quality_sampling), notice: 'Quality sampling was successfully created.'
44
      redirect_to collection_sampling_review_flow_path(@collection.owner, @collection, @quality_sampling)
×
45
    else
×
46
      render :index
×
47
    end
×
48
  end
×
49

50
  # PATCH/PUT /quality_samplings/1
51
  def update
×
52
    if @quality_sampling.update(quality_sampling_params)
×
53
      redirect_to @quality_sampling, notice: t('.quality_sampling_updated')
×
54
    else
×
55
      render :edit
×
56
    end
×
57
  end
×
58

59
  # DELETE /quality_samplings/1
60
  def destroy
×
61
    @quality_sampling.destroy
×
62
    redirect_to quality_samplings_url, notice: t('.quality_sampling_destroyed')
×
63
  end
×
64

65
  private
×
66
    def authorized?
×
67
      unless user_signed_in? && current_user.can_review?(@collection)
×
68
        redirect_to new_user_session_path
×
69
      end
×
70
    end
×
71

72
    # Use callbacks to share common setup or constraints between actions.
73
    def set_quality_sampling
×
74
      @quality_sampling = QualitySampling.find(params[:id])
×
75
    end
×
76

77
    # Only allow a trusted parameter "white list" through.
78
    def quality_sampling_params
×
79
      params.require(:quality_sampling).permit(:sample_type, :start_time, :previous_start, :user_id, :collection_id, :field, :additional_pages)
×
80
    end
×
81
end
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc