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

uclibs / application_portfolio / 5905684164

18 Aug 2023 06:03PM UTC coverage: 61.162% (+3.1%) from 58.077%
5905684164

push

circleci

web-flow
Merge pull request #301 from uclibs/272/change_request

Add Change Request and Update Log

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

674 of 1102 relevant lines covered (61.16%)

16.79 hits per line

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

91.38
/app/controllers/front_controller.rb
1
# frozen_string_literal: true
2

3
class FrontController < ApplicationController
2✔
4
  layout 'application'
2✔
5
  include ApplicationHelper
2✔
6
  include SoftwareRecordsHelper
2✔
7
  before_action :authenticate_user!, only: %i[dashboard profile search]
2✔
8
  before_action :navigation
2✔
9
  helper_method :sort_column, :sort_direction
2✔
10

11
  def index
2✔
12
    $page_title = 'Welcome | UCL Application Portfolio'
2✔
13
    @controller = params[:controller]
2✔
14
  end
15

16
  def dashboard
2✔
17
    $page_title = 'Dashboard | UCL Application Portfolio'
6✔
18
    @user = "#{current_user.first_name} #{current_user.last_name}"
6✔
19
    @softwarerecords_indesign = SoftwareRecordsController.indesign_dashboard(@user).order("#{sort_column} #{sort_direction}")
6✔
20
    begin
21
      @indesign_count = @softwarerecords_indesign.count
6✔
22
    rescue StandardError
23
      @indesign_count = 0
×
24
    end
25
    @softwarerecords_production = SoftwareRecordsController.production_dashboard(@user).order("#{sort_column}
6✔
26
#{sort_direction}")
27
    begin
28
      @production_count = @softwarerecords_production.count
6✔
29
    rescue StandardError
30
      @production_count = 0
×
31
    end
32

33
    @softwarerecords_inchange = SoftwareRecordsController.inchange_dashboard(@user).order("#{sort_column} #{sort_direction}")
6✔
34
    # @software_change_hash = ChangeRequest.joins(:software_record).where('software_records.id = ?', @id)
35
    # @softwarerecords_change = SoftwareRecordsController.change_dashboard(@user).order("#{sort_column} #{sort_direction}").where(change_completed: true)
36
    begin
37
      @inchange_count = @softwarerecords_inchange.count
6✔
38
    rescue StandardError
39
      @inchange_count = 0
×
40
    end
41
    render 'dashboard'
6✔
42
  end
43

44
  def about
2✔
45
    $page_title = 'About Us | UCL Application Portfolio'
4✔
46
    render 'about'
4✔
47
  end
48

49
  def contact
2✔
50
    $page_title = 'Contact Us | UCL Application Portfolio'
4✔
51
    render 'contact'
4✔
52
  end
53

54
  def profile
2✔
55
    $page_title = 'My Profile | UCL Application Portfolio'
2✔
56
    @users = User.all
2✔
57
    render 'profile'
2✔
58
  end
59

60
  def new
2✔
61
    $page_title = 'Request Software | UCL Application Portfolio'
2✔
62
    @requestnewsoftwares = SoftwareRecord.new
2✔
63
  end
64

65
  def search
2✔
66
    if params[:search].blank?
8✔
67
      redirect_to(root_path, alert: 'Cannot search on empty field!') && return
4✔
68
    else
69
      @parameter = params[:search].downcase
4✔
70
      search_term = "%#{@parameter}%"
4✔
71

72
      software_records_columns = SoftwareRecord.columns.map { |column| "lower(#{column.name}) LIKE :search" }
272✔
73
      @softwarerecords_results = SoftwareRecord.where(software_records_columns.join(' OR '), search: search_term)
4✔
74

75
      vendor_records_columns = VendorRecord.columns.map { |column| "lower(#{column.name}) LIKE :search" }
24✔
76
      @vendorrecords_results = VendorRecord.where(vendor_records_columns.join(' OR '), search: search_term)
4✔
77

78
      software_types_columns = SoftwareType.columns.map { |column| "lower(#{column.name}) LIKE :search" }
24✔
79
      @softwaretypes_results = SoftwareType.where(software_types_columns.join(' OR '), search: search_term)
4✔
80
    end
81
  end
82

83
  def create
2✔
84
    @requestnewsoftwares = SoftwareRecord.new(params.require(:software_record).permit(:title,
4✔
85
                                                                                      :description, :status, :created_by,
86
                                                                                      :tentative_date_of_implementation, :notes, :departments, :product_owners, :software_type_id, :vendor_recor_id))
87
    if @requestnewsoftwares.save
4✔
88
      AdminMailer.send_email(params[:id], params[:created_by])
×
89
      redirect_to @request_softwares, notice: 'Software record was successfully requested.'
×
90
    else
91
      redirect_to request_new_path
4✔
92
    end
93
  end
94

95
  private
2✔
96

97
  def sort_column
2✔
98
    SoftwareRecord.column_names.include?(params[:sort]) ? params[:sort] : 'title'
18✔
99
  end
100

101
  def sort_direction
2✔
102
    %w[asc desc].include?(params[:direction]) ? params[:direction] : 'asc'
18✔
103
  end
104
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