rubyforgood / rubyforgood/alongwithyou

[FEATURE] Add Transportation Log

Open
#200 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement Rails App RFG Conference
Dominant language
TypeScript
Stars
9
Forks
4
Avg merge
9h 34m
Merged PRs (30d)
16

Description

Description

A transportation expense is a kind of log entry. It is a Log delegated type, and the Log carries the date.

Fields come from the journal's Transportation Expenses table (Section 10): Date, From, To, Car or Service, Mileage Reimbursement, Parking/Tip, Total.

TransportationExpense

  • Is a Log delegated type (required) — the date lives on the Log
  • From (String)
  • To (String)
  • Car or service — two values: car, service
  • Mileage reimbursement (Decimal, dollars)
  • Parking/tip (Decimal, dollars)

Relationships: Log

Total is not stored. It's mileage reimbursement + parking/tip, computed for display.

UI

Standard scaffolding, plus the pieces that make the expense visible from the log:

  • Index — follows the same tabular presentation pattern as app/views/prescriptions/index.html.erb. Copy that structure: the .table-scroll wrapper carrying tabindex="0", role="region" and an aria-label; <th scope="col"> headers; the first cell as <th scope="row"> linking to the show page; or_dash for optional values; table-note spans for secondary detail; and an empty-state paragraph when there are none. Columns: Date, From, To, Car or service, Mileage reimbursement, Parking/tip, Total. Date order.
  • Register TransportationExpense in Log's delegated_type list so it appears in the log type selector.
  • Add a partial in app/views/transportation_expenses/ that renders the expense's details in a log context.
  • Modify the Log index and show to render that partial, dispatching on the loggable type — the same mechanism the Appointment ticket establishes. Keep the generic fallback intact.
  • Money formats as currency; blank amounts use or_dash.

Acceptance Criteria

  • A user can add, view, edit and delete a transportation expense
  • Saving requires a date
  • Mileage reimbursement and parking/tip store dollar amounts, not miles
  • Total displays as mileage reimbursement + parking/tip, and is not a database column
  • The index matches the prescriptions index pattern: scrollable labelled region, scoped table headers, row header linking to show, dashes for blanks, empty state
  • TransportationExpense appears in the log type selector
  • The log index and show render transportation expense details via the partial
  • Log entries of a type with no partial still render via the fallback
  • Model tests cover create, the total calculation, and the total when one or both amounts are blank

Notes

  • Appointment connection is out of scope. The ERD marks it "optionally connect to appointment"; we're not building that link in this ticket.
  • The journal's section header has "If you use a ride service, Company: ___ Phone: ___". That's standing information about the person, not per-trip data. Out of scope here.
  • The journal footnote is "Mileage X Government Reimbursement Rate" — the user does that arithmetic themselves and enters the dollar result. We are not storing a mileage rate or doing the conversion.
  • Open: how "car or service" is stored — a Rails enum, or a seeded lookup table like MedicationType/AppointmentType. Decide before assigning.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with app/views/prescriptions/index.html.erb for the required index pattern, then inspect Log's delegated_type list and the Appointment ticket's log partial mechanism. The app/views/transportation_expenses/ partial, Log index and show, and model tests should cover the stated acceptance criteria, including the unresolved choice between an enum and a lookup table for car or service.

Written by the indexing model from the issue text.

Assessment

Tech stack
rails, ruby
Domain
full-stack
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.