Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions app/models/medical_shift.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,8 @@ def title
def recurring?
medical_shift_recurrence_id.present?
end

def formatted_amount
amount.format(thousands_separator: ".", decimal_mark: ",")
end
end
2 changes: 1 addition & 1 deletion app/serializers/event_procedure_serializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def date
end

def precedure_value
object.procedure.amount.format
object.procedure.amount.format(thousands_separator: ".", decimal_mark: ",")
end

def precedure_description
Expand Down
2 changes: 1 addition & 1 deletion app/serializers/medical_shift_serializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def hour
end

def amount_cents
object.amount.format
object.formatted_amount
end

def workload
Expand Down
2 changes: 1 addition & 1 deletion spec/requests/api/v1/event_procedures_request_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@
"payment" => EventProcedures::Payments::HEALTH_INSURANCE,
"urgency" => false,
"paid" => true,
"precedure_value" => "R$200.00",
"precedure_value" => "R$200,00",
"precedure_description" => "nice description"
)
end
Expand Down
16 changes: 8 additions & 8 deletions spec/requests/api/v1/medical_shifts_request_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"workload" => medical_shifts.second.workload_humanize,
"date" => medical_shifts.second.start_date.strftime("%d/%m/%Y"),
"hour" => medical_shifts.second.start_hour.strftime("%H:%M"),
"amount_cents" => medical_shifts.second.amount.format,
"amount_cents" => medical_shifts.second.amount.format(thousands_separator: ".", decimal_mark: ","),
"paid" => medical_shifts.second.paid,
"shift" => medical_shifts.second.shift,
"title" => "#{second_hospital_name} | #{second_workload} | #{second_shift}",
Expand All @@ -51,7 +51,7 @@
"workload" => medical_shifts.first.workload_humanize,
"date" => medical_shifts.first.start_date.strftime("%d/%m/%Y"),
"hour" => medical_shifts.first.start_hour.strftime("%H:%M"),
"amount_cents" => medical_shifts.first.amount.format,
"amount_cents" => medical_shifts.first.formatted_amount,
"paid" => medical_shifts.first.paid,
"shift" => medical_shifts.first.shift,
"title" => "#{first_hospital_name} | #{first_workload} | #{first_shift}",
Expand Down Expand Up @@ -134,7 +134,7 @@
"workload" => paid_medical_shifts.second.workload_humanize,
"date" => paid_medical_shifts.second.start_date.strftime("%d/%m/%Y"),
"hour" => paid_medical_shifts.second.start_hour.strftime("%H:%M"),
"amount_cents" => paid_medical_shifts.second.amount.format,
"amount_cents" => paid_medical_shifts.second.formatted_amount,
"paid" => paid_medical_shifts.second.paid,
"shift" => paid_medical_shifts.second.shift,
"title" => "#{second_hospital_name} | #{second_workload} | #{second_shift}",
Expand All @@ -147,7 +147,7 @@
"workload" => paid_medical_shifts.first.workload_humanize,
"date" => paid_medical_shifts.first.start_date.strftime("%d/%m/%Y"),
"hour" => paid_medical_shifts.first.start_hour.strftime("%H:%M"),
"amount_cents" => paid_medical_shifts.first.amount.format,
"amount_cents" => paid_medical_shifts.first.formatted_amount,
"paid" => paid_medical_shifts.first.paid,
"shift" => paid_medical_shifts.first.shift,
"title" => "#{first_hospital_name} | #{first_workload} | #{first_shift}",
Expand Down Expand Up @@ -177,7 +177,7 @@
"workload" => unpaid_medical_shifts.second.workload_humanize,
"date" => unpaid_medical_shifts.second.start_date.strftime("%d/%m/%Y"),
"hour" => unpaid_medical_shifts.second.start_hour.strftime("%H:%M"),
"amount_cents" => unpaid_medical_shifts.second.amount.format,
"amount_cents" => unpaid_medical_shifts.second.formatted_amount,
"paid" => unpaid_medical_shifts.second.paid,
"shift" => unpaid_medical_shifts.second.shift,
"title" => "#{second_hospital_name} | #{second_workload} | #{second_shift}",
Expand All @@ -190,7 +190,7 @@
"workload" => unpaid_medical_shifts.first.workload_humanize,
"date" => unpaid_medical_shifts.first.start_date.strftime("%d/%m/%Y"),
"hour" => unpaid_medical_shifts.first.start_hour.strftime("%H:%M"),
"amount_cents" => unpaid_medical_shifts.first.amount.format,
"amount_cents" => unpaid_medical_shifts.first.formatted_amount,
"paid" => unpaid_medical_shifts.first.paid,
"shift" => unpaid_medical_shifts.first.shift,
"title" => "#{first_hospital_name} | #{first_workload} | #{first_shift}",
Expand Down Expand Up @@ -277,7 +277,7 @@
workload: MedicalShift.last.workload_humanize,
date: MedicalShift.last.start_date.strftime("%d/%m/%Y"),
hour: MedicalShift.last.start_hour.strftime("%H:%M"),
amount_cents: MedicalShift.last.amount.format,
amount_cents: MedicalShift.last.formatted_amount,
paid: params[:paid],
shift: MedicalShift.last.shift,
title: "#{hospital_name} | #{workload} | #{shift}",
Expand Down Expand Up @@ -361,7 +361,7 @@
workload: workload,
date: medical_shift.start_date.strftime("%d/%m/%Y"),
hour: medical_shift.start_hour.strftime("%H:%M"),
amount_cents: medical_shift.amount.format,
amount_cents: medical_shift.formatted_amount,
paid: medical_shift.paid,
shift: medical_shift.reload.shift,
title: "#{hospital_name} | #{workload} | #{shift}"
Expand Down