gems-uff/sapos

View on GitHub

Showing 400 of 400 total issues

Similar blocks of code found in 2 locations. Consider refactoring.
Open

table = curr_pdf.make_table(
data_table_rows,
cell_style: {
borders: [:left, :right, :bottom, :top],
border_bottom_width: 0.5,
Severity: Minor
Found in app/helpers/enrollments_pdf_helper.rb and 1 other location - About 25 mins to fix
app/helpers/enrollments_pdf_helper.rb on lines 724..738

Similar blocks of code found in 2 locations. Consider refactoring.
Open

when APPROVED
self.errors.add(
:grade, :grade_for_situation_aproved,
minimum_grade_for_approval: (minimum.to_f / 10.0).to_s.tr(".", ",")
) if (
Severity: Minor
Found in app/models/class_enrollment.rb and 1 other location - About 25 mins to fix
app/models/class_enrollment.rb on lines 152..159

Similar blocks of code found in 2 locations. Consider refactoring.
Open

def that_duration_is_not_blank
return unless [0, nil].include?(self.duration_semesters)
return unless [0, nil].include?(self.duration_months)
return unless [0, nil].include?(self.duration_days)
errors.add(:duration, :blank_duration)
Severity: Minor
Found in app/models/deferral_type.rb and 1 other location - About 25 mins to fix
app/models/phase_duration.rb on lines 34..38

Identical blocks of code found in 2 locations. Consider refactoring.
Open

pdf.table(
table_data,
column_widths: table_width,
row_colors: ["F2F2FF", "E5E5FF"],
cell_style: {
Severity: Minor
Found in app/helpers/enrollments_pdf_helper.rb and 1 other location - About 25 mins to fix
app/helpers/enrollments_pdf_helper.rb on lines 307..321

Identical blocks of code found in 2 locations. Consider refactoring.
Open

respond_to do |format|
format.pdf do
title = I18n.t("pdf_content.class_schedule.class_schedule_pdf.title")
send_data render_class_schedules_class_schedule_pdf(year, semester),
filename: "#{title} (#{year}_#{semester}).pdf",
Severity: Minor
Found in app/controllers/course_classes_controller.rb and 1 other location - About 25 mins to fix
app/controllers/class_schedules_controller.rb on lines 65..71

Identical blocks of code found in 2 locations. Consider refactoring.
Open

respond_to do |format|
format.pdf do
title = I18n.t("pdf_content.class_schedule.class_schedule_pdf.title")
send_data render_class_schedules_class_schedule_pdf(year, semester),
filename: "#{title} (#{year}_#{semester}).pdf",
Severity: Minor
Found in app/controllers/class_schedules_controller.rb and 1 other location - About 25 mins to fix
app/controllers/course_classes_controller.rb on lines 118..124

Similar blocks of code found in 2 locations. Consider refactoring.
Open

def selected_student_is_already_linked_to_another_user
return if student.blank?
return unless student.errors.messages[:user].include? I18n.t(
"activerecord.errors.models.student.attributes.user.changed_to_different_user"
)
Severity: Minor
Found in app/models/user.rb and 1 other location - About 20 mins to fix
app/models/user.rb on lines 105..114

Similar blocks of code found in 2 locations. Consider refactoring.
Open

def obs_schedule_form_column(record, options)
if can?(:post_grades, record) && cannot?(:update_all_fields, record)
options[:disabled] = true
end
text_field :record, :obs_schedule, options.merge!(
Severity: Minor
Found in app/helpers/course_classes_helper.rb and 1 other location - About 20 mins to fix
app/helpers/course_classes_helper.rb on lines 46..53

Similar blocks of code found in 2 locations. Consider refactoring.
Open

def name_form_column(record, options)
if can?(:post_grades, record) && cannot?(:update_all_fields, record)
options[:disabled] = true
end
text_field :record, :name, options.merge!(
Severity: Minor
Found in app/helpers/course_classes_helper.rb and 1 other location - About 20 mins to fix
app/helpers/course_classes_helper.rb on lines 95..102

Similar blocks of code found in 2 locations. Consider refactoring.
Open

def selected_professor_is_already_linked_to_another_user
return if professor.blank?
return unless professor.errors.messages[:user].include? I18n.t(
"activerecord.errors.models.professor.attributes.user.changed_to_different_user"
)
Severity: Minor
Found in app/models/user.rb and 1 other location - About 20 mins to fix
app/models/user.rb on lines 117..126

Similar blocks of code found in 2 locations. Consider refactoring.
Open

def filled_position
rconfig = self.ranking_config
self.filled_form.fields.each do |field|
return field if field.form_field_id == rconfig.position_field_id
end
Severity: Minor
Found in app/models/admissions/admission_ranking_result.rb and 1 other location - About 20 mins to fix
app/models/admissions/admission_ranking_result.rb on lines 42..47

Similar blocks of code found in 2 locations. Consider refactoring.
Open

header = [[
"<b>#{I18n.t("pdf_content.advisements.to_pdf.professor_name")}</b>",
"<b>#{I18n.t("pdf_content.advisements.to_pdf.enrollment_number")}</b>",
"<b>#{I18n.t("pdf_content.advisements.to_pdf.student_name")}</b>",
"<b>#{I18n.t("pdf_content.advisements.to_pdf.level_name")}</b>"
Severity: Minor
Found in app/helpers/advisements_pdf_helper.rb and 1 other location - About 20 mins to fix
app/helpers/enrollments_pdf_helper.rb on lines 186..191

Similar blocks of code found in 2 locations. Consider refactoring.
Open

if cer.action == ClassEnrollmentRequest::REMOVE
next unselect_removal(cer, class_schedule, request_change)
end
if cer.status == ClassEnrollmentRequest::EFFECTED
next unselect_effected_insertion(cer, class_schedule, request_change)
Severity: Minor
Found in app/models/enrollment_request.rb and 1 other location - About 20 mins to fix
app/models/enrollment_request.rb on lines 136..142

Similar blocks of code found in 2 locations. Consider refactoring.
Open

if cer.action == ClassEnrollmentRequest::INSERT
next select_insertion(cer, class_schedule, request_change)
end
if cer.status == ClassEnrollmentRequest::EFFECTED
next select_effected_removal(cer, class_schedule, request_change)
Severity: Minor
Found in app/models/enrollment_request.rb and 1 other location - About 20 mins to fix
app/models/enrollment_request.rb on lines 144..150

Similar blocks of code found in 2 locations. Consider refactoring.
Open

header = [[
"<b>#{I18n.t("activerecord.attributes.enrollment.student")}</b>",
"<b>#{I18n.t("activerecord.attributes.enrollment.enrollment_number")}</b>",
"<b>#{I18n.t("activerecord.attributes.enrollment.admission_date")}</b>",
"<b>#{I18n.t("activerecord.attributes.enrollment.dismissal")}</b>"
Severity: Minor
Found in app/helpers/enrollments_pdf_helper.rb and 1 other location - About 20 mins to fix
app/helpers/advisements_pdf_helper.rb on lines 12..17

Similar blocks of code found in 2 locations. Consider refactoring.
Open

def filled_machine
rconfig = self.ranking_config
self.filled_form.fields.each do |field|
return field if field.form_field_id == rconfig.machine_field_id
end
Severity: Minor
Found in app/models/admissions/admission_ranking_result.rb and 1 other location - About 20 mins to fix
app/models/admissions/admission_ranking_result.rb on lines 34..39

Identical blocks of code found in 2 locations. Consider refactoring.
Open

lines = pdf.text_box text, at: [(pdf.bounds.width - box_width) / 2, pdf.cursor], width: box_width, height: box_height, align: :justify, inline_format: true, dry_run: true
end
Severity: Minor
Found in app/helpers/assertions_pdf_helper.rb and 1 other location - About 15 mins to fix
app/helpers/assertions_pdf_helper.rb on lines 25..27

Identical blocks of code found in 2 locations. Consider refactoring.
Open

lines = pdf.text_box text, at: [(pdf.bounds.width - box_width) / 2, pdf.cursor], width: box_width, height: box_height, align: :justify, inline_format: true, dry_run: true
 
while lines.size > 0
Severity: Minor
Found in app/helpers/assertions_pdf_helper.rb and 1 other location - About 15 mins to fix
app/helpers/assertions_pdf_helper.rb on lines 32..33

Similar blocks of code found in 2 locations. Consider refactoring.
Open

table.column(0).align = :left
table.column(0).padding = [2, 4]
table.column(2).align = :left
table.column(2).padding = [2, 4]
Severity: Minor
Found in app/helpers/advisements_pdf_helper.rb and 1 other location - About 15 mins to fix
app/helpers/course_classes_pdf_helper.rb on lines 143..146

Similar blocks of code found in 2 locations. Consider refactoring.
Open

table.column(2).align = :left
table.column(2).padding = [2, 4]
table.column(3).align = :left
table.column(3).padding = [2, 4]
Severity: Minor
Found in app/helpers/course_classes_pdf_helper.rb and 1 other location - About 15 mins to fix
app/helpers/advisements_pdf_helper.rb on lines 20..23
Severity
Category
Status
Source
Language