Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014aUaQeLnwbb1zTpN7kHeat
56 lines
2.3 KiB
Markdown
56 lines
2.3 KiB
Markdown
# 1. Goal
|
|
Summarise the lift pass scans of one day at a ski resort. The operations team
|
|
needs one function module. The function module reads the scans and the lift
|
|
list. It returns the statistics and a report.
|
|
|
|
# 2. Open questions
|
|
None.
|
|
|
|
# 3. Context
|
|
- Function group {{P}}FG_LIFT exists in package $TMP.
|
|
- The turnstile system sends the scans of the day as a text. Each line of this
|
|
text has the format `pass;lift`.
|
|
- The resort keeps a list of its lifts. Each line of this list has the format
|
|
`lift;area`.
|
|
- The lines of both texts are separated by the newline character
|
|
(cl_abap_char_utilities=>newline).
|
|
|
|
# 4. Contract
|
|
- Create the function module {{P}}LIFT_STATS in function group {{P}}FG_LIFT.
|
|
- Interface:
|
|
- Importing: iv_scans TYPE string, iv_lifts TYPE string
|
|
- Exporting: ev_rides TYPE i, ev_passes TYPE i, ev_report TYPE string
|
|
- Exceptions: no_lifts
|
|
|
|
# 5. Business rules
|
|
1. A line of a text is valid if it contains exactly one `;` and the text
|
|
before and the text after this `;` are both not empty. Ignore every other
|
|
line.
|
|
2. If iv_lifts contains no valid line, raise the exception no_lifts. Do not
|
|
change the exporting parameters in this case.
|
|
3. The lift list gives the area of a lift. If a lift occurs more than once,
|
|
the first line wins.
|
|
4. Ignore a scan if its lift is not in the lift list.
|
|
5. Count a scan once for a pass and a lift. If the same pass and the same lift
|
|
occur more than once, they count once.
|
|
6. For each pass, count its rides and its areas. The rides are the number of
|
|
the distinct lifts of the pass. The areas are the number of the distinct
|
|
areas of these lifts.
|
|
7. ev_rides is the total number of counted scans. ev_passes is the number of
|
|
passes.
|
|
8. ev_report has one line for each pass. Sort the lines by pass in ascending
|
|
order. A line has the format `pass;rides;areas`. Separate the lines by the
|
|
newline character. Do not put a newline character after the last line. If
|
|
there is no pass, ev_report is empty.
|
|
|
|
# 6. Constraints
|
|
- Release target: 8.16.
|
|
- Package: $TMP. Do not use transports.
|
|
- Coding standard: Clean ABAP. Keep every procedure below 40 statements.
|
|
- Out of scope: none.
|
|
|
|
# 7. Acceptance
|
|
- The function module is active and has no syntax error.
|
|
- The hidden tests pass.
|
|
- Write ABAP Unit tests for the function module in a global test class.
|