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

MarkUsProject / Markus / 16733098629

04 Aug 2025 08:07PM UTC coverage: 91.884%. Remained the same
16733098629

Pull #7631

github

web-flow
Merge b638afd4e into 795d39e35
Pull Request #7631: [pre-commit.ci] pre-commit autoupdate

658 of 1419 branches covered (46.37%)

Branch coverage included in aggregate %.

16 of 16 new or added lines in 16 files covered. (100.0%)

155 existing lines in 10 files now uncovered.

42034 of 45044 relevant lines covered (93.32%)

118.71 hits per line

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

94.23
/app/controllers/admin/courses_controller.rb
1
module Admin
1✔
2
  class CoursesController < ApplicationController
1✔
3
    include AutomatedTestsHelper::AutotestApi
1✔
4
    DEFAULT_FIELDS = [:id, :name, :is_hidden, :display_name].freeze
1✔
5
    before_action { authorize! }
43✔
6

7
    respond_to :html
1✔
8
    layout 'assignment_content'
1✔
9

10
    def index
1✔
11
      respond_to do |format|
3✔
12
        format.html
3✔
13
        format.json { render json: Course.order(:created_at).to_json(only: DEFAULT_FIELDS) }
5✔
14
      end
15
    end
16

17
    def new
1✔
18
      @current_course = Course.new
1✔
19
    end
20

21
    def create
1✔
22
      @current_course = Course.create(course_create_params)
4✔
23
      update_autotest_url if @current_course.persisted?
4✔
24
      respond_with @current_course, location: -> { admin_courses_path }
7✔
25
    end
26

27
    def edit
1✔
28
      @lti_deployments = @current_course.lti_deployments
1✔
29
    end
30

31
    def update
1✔
32
      current_course.update(course_update_params)
5✔
33
      update_autotest_url
5✔
34
      respond_with @current_course, location: -> { edit_admin_course_path(@current_course) }
9✔
35
    end
36

37
    def test_autotest_connection
1✔
38
      settings = current_course.autotest_setting
5✔
39
      return head :unprocessable_entity unless settings&.url
5✔
40
      begin
41
        get_schema(current_course.autotest_setting)
4✔
42
        flash_now(:success, I18n.t('automated_tests.manage_connection.test_success', url: settings.url))
2✔
43
      rescue JSON::ParserError
44
        flash_now(:error, I18n.t('automated_tests.manage_connection.test_schema_failure', url: settings.url))
1✔
45
      rescue StandardError => e
46
        flash_now(:error, I18n.t('automated_tests.manage_connection.test_failure', url: settings.url, error: e.to_s))
1✔
47
      end
48
      head :ok
4✔
49
    end
50

51
    def reset_autotest_connection
1✔
52
      settings = current_course.autotest_setting
2✔
53
      return head :unprocessable_entity unless settings&.url
2✔
54
      @current_job = AutotestResetUrlJob.perform_later(current_course,
1✔
55
                                                       settings.url,
56
                                                       request.protocol + request.host_with_port,
57
                                                       refresh: true)
58
      session[:job_id] = @current_job.job_id if @current_job
1✔
59
      respond_with current_course, location: -> { edit_admin_course_path(current_course) }
2✔
60
    end
61

62
    def destroy_lti_deployment
1✔
UNCOV
63
      deployment = LtiDeployment.find(params[:lti_deployment_id])
×
64
      deployment.destroy!
×
65
      redirect_to edit_admin_course_path(@current_course)
×
66
    end
67

68
    private
1✔
69

70
    def course_create_params
1✔
71
      params.require(:course).permit(:name, :is_hidden, :display_name, :max_file_size)
4✔
72
    end
73

74
    def course_update_params
1✔
75
      params.require(:course).permit(:is_hidden, :display_name, :max_file_size)
5✔
76
    end
77

78
    def update_autotest_url
1✔
79
      url = params.require(:course).permit(:autotest_url)[:autotest_url]
8✔
80
      @current_job = AutotestResetUrlJob.perform_later(current_course, url, request.protocol + request.host_with_port)
8✔
81
      session[:job_id] = @current_job.job_id if @current_job
8✔
82
    end
83

84
    def flash_interpolation_options
1✔
85
      { resource_name: @current_course.name.presence || @current_course.model_name.human,
10✔
86
        errors: @current_course.errors.full_messages.join('; ') }
87
    end
88
  end
89
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