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

curationexperts / laevigata / a89c0ced-554e-4aeb-bbb1-66fb603498ae

05 May 2025 07:34PM UTC coverage: 93.347% (-1.6%) from 94.984%
a89c0ced-554e-4aeb-bbb1-66fb603498ae

Pull #2458

circleci

web-flow
Corrects spelling mistake

"Afer" --> "After"
Pull Request #2458: Corrects spelling mistake

2666 of 2856 relevant lines covered (93.35%)

42.0 hits per line

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

86.84
/app/controllers/in_progress_etds_controller.rb
1
class InProgressEtdsController < ApplicationController
3✔
2
  def new
3✔
3
    authorize! :create, InProgressEtd
6✔
4

5
    @in_progress_etd = if params[:etd_id]
6✔
6
                         InProgressEtd.find_or_create_by(etd_id: params[:etd_id])
4✔
7
                       else
8
                         InProgressEtd.find_or_create_by(user_ppid: current_user.ppid)
2✔
9
                       end
10

11
    # Now that the record has been created, render the form so student can edit it:
12
    redirect_to action: :edit, id: @in_progress_etd.id
6✔
13
  end
14

15
  # Note: There is no 'create' action because the 'new' action does 'find or create'.
16

17
  def edit
3✔
18
    if current_user.nil?
9✔
19
      redirect_to new_user_session_path
1✔
20
    else
21
      @in_progress_etd = InProgressEtd.find(params[:id])
8✔
22
      authorize! :update, @in_progress_etd
7✔
23
      @in_progress_etd.refresh_from_etd!
6✔
24
      @data = @in_progress_etd.data
6✔
25
    end
26
  rescue ActiveRecord::RecordNotFound
27
    redirect_to root_url
1✔
28
  end
29

30
  # The Vue.js form uses this action to update the record.
31
  def update
3✔
32
    @in_progress_etd = InProgressEtd.find(params[:id])
7✔
33
    authorize! :update, @in_progress_etd
7✔
34
    @in_progress_etd.data = prepare_etd_data.to_json
7✔
35

36
    if @in_progress_etd.save
7✔
37
      @data = @in_progress_etd.data
7✔
38
      render json: { in_progress_etd: @data, lastCompletedStep: current_step(@data), tab_name: tab_name }, status: 200
7✔
39
    else
40
      render json: { errors: @in_progress_etd.errors.messages }, status: 422
×
41
    end
42
  end
43

44
  def destroy
3✔
45
    @in_progress_etd = InProgressEtd.find(params[:id])
×
46
    authorize! :update, @in_progress_etd
×
47
    @in_progress_etd.destroy
×
48

49
    redirect_to root_url
×
50
  end
51

52
  private
3✔
53

54
    def current_step(data)
3✔
55
      saved_data = JSON.parse(data)
7✔
56
      saved_data['currentStep']
7✔
57
    end
58

59
    def tab_name
3✔
60
      etd = request.parameters.fetch(:etd)
7✔
61
      etd.fetch(:currentTab, "About Me")
7✔
62
    end
63

64
    def prepare_etd_data
3✔
65
      # TODO: strong params
66
      new_data = request.parameters.fetch(:etd, {})
7✔
67

68
      # Add the new data to the existing persisted data
69
      @in_progress_etd.add_data(new_data)
7✔
70
    end
71
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