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

curationexperts / laevigata / 464e6921-67a8-447f-9dd0-067e161e62fa

18 Apr 2026 09:18PM UTC coverage: 94.351% (-3.1%) from 97.462%
464e6921-67a8-447f-9dd0-067e161e62fa

push

circleci

web-flow
Merge pull request #2499 from curationexperts/deactivate_depts

[MAINTENANCE] Increase test coverage for workflow CommentNotifications

2706 of 2868 relevant lines covered (94.35%)

38.15 hits per line

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

83.72
/app/controllers/in_progress_etds_controller.rb
1
class InProgressEtdsController < ApplicationController
2✔
2
  def new
2✔
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
2✔
18
    if current_user.nil?
6✔
19
      redirect_to new_user_session_path
×
20
    else
21
      @in_progress_etd = InProgressEtd.find(params[:id])
6✔
22
      authorize! :update, @in_progress_etd
6✔
23
      @in_progress_etd.refresh_from_etd!
6✔
24
      @data = @in_progress_etd.data
6✔
25
      @form_level = form_level
6✔
26
    end
27
  rescue ActiveRecord::RecordNotFound
28
    redirect_to root_url
×
29
  end
30

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

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

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

50
    redirect_to root_url
×
51
  end
52

53
  private
2✔
54

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

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

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

69
      # Add the new data to the existing persisted data
70
      @in_progress_etd.add_data(new_data)
7✔
71
    end
72

73
    # Show :basic form for regular users - e.g. active field values only
74
    # Or :advanced form for super_admins - e.g. also show inactive fields values
75
    def form_level
2✔
76
      return :advanced if current_user.admin?
6✔
77
      return :advanced if current_ability.can_review_submissions?
2✔
78
      :basic
2✔
79
    end
80
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