Stage 2 summary at 50 accepted trajectories

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Kral
2026-10-05 18:02:52 +02:00
parent 332fb4601d
commit 5bcd1bf9cd
1230 changed files with 77563 additions and 33 deletions

View File

@@ -0,0 +1,16 @@
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'Honey yield per apiary'
define view entity {{P}}I_HONEY_YIELD
as select from {{p}}apiary as api
inner join {{p}}honey as harv on harv.apiary_id = api.apiary_id
{
key api.apiary_id as apiary_id,
api.beekeeper as beekeeper,
api.region as region,
count( * ) as harvest_count,
sum( harv.kilograms ) as total_kg
}
group by
api.apiary_id,
api.beekeeper,
api.region

View File

@@ -0,0 +1,48 @@
CLASS {{p}}t41_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 total_of_one_apiary FOR TESTING.
METHODS apiary_without_harvest FOR TESTING.
ENDCLASS.
CLASS {{p}}t41_test IMPLEMENTATION.
METHOD class_setup.
go_env = cl_cds_test_environment=>create( i_for_entity = '{{P}}I_HONEY_YIELD' ).
ENDMETHOD.
METHOD class_teardown.
go_env->destroy( ).
ENDMETHOD.
METHOD setup.
DATA lt_apiary TYPE STANDARD TABLE OF {{p}}apiary WITH EMPTY KEY.
DATA lt_honey TYPE STANDARD TABLE OF {{p}}honey WITH EMPTY KEY.
go_env->clear_doubles( ).
lt_apiary = VALUE #(
( apiary_id = 'B1' beekeeper = 'BK9' region = 'EAST' hive_count = 6 )
( apiary_id = 'B2' beekeeper = 'BK8' region = 'EAST' hive_count = 2 ) ).
lt_honey = VALUE #(
( apiary_id = 'B1' harvest_no = 1 region = 'EAST' harvest_date = '20240501' kilograms = '7.50' )
( apiary_id = 'B1' harvest_no = 2 region = 'EAST' harvest_date = '20240601' kilograms = '2.50' ) ).
go_env->insert_test_data( lt_apiary ).
go_env->insert_test_data( lt_honey ).
ENDMETHOD.
METHOD total_of_one_apiary.
SELECT SINGLE harvest_count, total_kg FROM {{p}}i_honey_yield WHERE apiary_id = 'B1'
INTO @DATA(ls_yield).
cl_abap_unit_assert=>assert_equals( exp = 2 act = ls_yield-harvest_count ).
cl_abap_unit_assert=>assert_equals( exp = CONV decfloat34( '10.00' )
act = CONV decfloat34( ls_yield-total_kg ) ).
ENDMETHOD.
METHOD apiary_without_harvest.
SELECT COUNT(*) FROM {{p}}i_honey_yield INTO @DATA(lv_rows).
cl_abap_unit_assert=>assert_equals( exp = 1 act = lv_rows ).
ENDMETHOD.
ENDCLASS.