Snapshot: new training tasks (balanced generation), docs

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Kral
2026-10-05 22:08:59 +02:00
parent eb13453097
commit 6984fc7917
572 changed files with 30024 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'Lift usage'
define view entity {{P}}I_LIFT_USAGE
as select from {{p}}lift as l
inner join {{p}}lift_op as o on o.lift_id = l.lift_id
and o.run_mode <> 'TEST'
{
key l.lift_id as lift_id,
key o.run_mode as run_mode,
l.building_id as building_id,
sum( o.run_hours ) as service_hours,
count( * ) as service_count,
max( o.run_date ) as last_service,
sum( o.trips ) as trip_total
}
group by l.lift_id, o.run_mode, l.building_id

View File

@@ -0,0 +1,50 @@
CLASS {{p}}lift_usage_test DEFINITION PUBLIC FINAL CREATE PUBLIC
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
PRIVATE SECTION.
CLASS-DATA go_env TYPE REF TO if_cds_test_environment.
CLASS-METHODS class_setup.
CLASS-METHODS class_teardown.
METHODS setup.
METHODS totals_of_one_mode FOR TESTING.
METHODS test_runs_are_ignored FOR TESTING.
ENDCLASS.
CLASS {{p}}lift_usage_test IMPLEMENTATION.
METHOD class_setup.
go_env = cl_cds_test_environment=>create( i_for_entity = '{{P}}I_LIFT_USAGE' ).
ENDMETHOD.
METHOD class_teardown.
go_env->destroy( ).
ENDMETHOD.
METHOD setup.
DATA lt_lift TYPE STANDARD TABLE OF {{p}}lift WITH EMPTY KEY.
DATA lt_op TYPE STANDARD TABLE OF {{p}}lift_op WITH EMPTY KEY.
go_env->clear_doubles( ).
lt_lift = VALUE #( ( lift_id = 'L1' building_id = 'B1' capacity_kg = '800.00' ) ).
lt_op = VALUE #( ( lift_id = 'L1' run_no = 1 run_date = '20240310' run_hours = '2.00' run_mode = 'AUTO' trips = 4 )
( lift_id = 'L1' run_no = 2 run_date = '20240311' run_hours = '1.00' run_mode = 'AUTO' trips = 6 )
( lift_id = 'L1' run_no = 3 run_date = '20240312' run_hours = '8.00' run_mode = 'TEST' trips = 50 ) ).
go_env->insert_test_data( lt_lift ).
go_env->insert_test_data( lt_op ).
ENDMETHOD.
METHOD totals_of_one_mode.
SELECT SINGLE service_hours, service_count, last_service, trip_total
FROM {{p}}i_lift_usage
WHERE lift_id = 'L1' AND run_mode = 'AUTO'
INTO @DATA(ls_row).
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '3.00' )
act = CONV decfloat34( ls_row-service_hours ) ).
cl_abap_unit_assert=>assert_equals( exp = 2 act = ls_row-service_count ).
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '10' )
act = CONV decfloat34( ls_row-trip_total ) ).
ENDMETHOD.
METHOD test_runs_are_ignored.
SELECT COUNT(*) FROM {{p}}i_lift_usage INTO @DATA(lv_rows).
cl_abap_unit_assert=>assert_equals( exp = 1 act = lv_rows ).
ENDMETHOD.
ENDCLASS.