Stage 2 summary at 50 accepted trajectories
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
50
tasks_gen/train/G1094/generation.json
Normal file
50
tasks_gen/train/G1094/generation.json
Normal file
@@ -0,0 +1,50 @@
|
||||
{
|
||||
"id": "G1094",
|
||||
"pool": "train",
|
||||
"object_type": "PROG",
|
||||
"category": "E",
|
||||
"attempts": [
|
||||
{
|
||||
"stage": "bundle",
|
||||
"errors": [
|
||||
"Too close to task G0141 (similarity spec 0.61, rules 0.61, names 0.33). Choose a different business topic and different object names.",
|
||||
"Too close to task G0190 (similarity spec 0.60, rules 0.68, names 0.25). Choose a different business topic and different object names.",
|
||||
"Too close to task G1090 (similarity spec 0.61, rules 0.62, names 0.25). Choose a different business topic and different object names."
|
||||
],
|
||||
"by_check": {
|
||||
"extra": 3
|
||||
}
|
||||
},
|
||||
{
|
||||
"stage": "bundle",
|
||||
"errors": [
|
||||
"seed/lesson.tabl.asabap: field name minutes is a reserved word; choose another name",
|
||||
"reference/lesson_old.prog.abap line 88: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"cl_abap_unit_assert\"",
|
||||
"reference/lesson_old.prog.abap line 88: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"5\"",
|
||||
"reference/lesson_old.prog.abap line 95: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"cl_abap_unit_assert\"",
|
||||
"reference/lesson_old.prog.abap line 95: syntax error for release v758 (abaplint): Statement does not exist in the configured ABAP version(or a parser error), \"75\"",
|
||||
"Too close to task G0190 (similarity spec 0.57, rules 0.62, names 0.25). Choose a different business topic and different object names."
|
||||
],
|
||||
"by_check": {
|
||||
"static": 1,
|
||||
"abaplint": 4,
|
||||
"extra": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"stage": "bundle",
|
||||
"errors": [
|
||||
"Too close to task G0190 (similarity spec 0.58, rules 0.62, names 0.25). Choose a different business topic and different object names."
|
||||
],
|
||||
"by_check": {
|
||||
"extra": 1
|
||||
}
|
||||
},
|
||||
{
|
||||
"stage": "validate",
|
||||
"oracle": 0,
|
||||
"null": 0
|
||||
}
|
||||
],
|
||||
"accepted": false
|
||||
}
|
||||
125
tasks_gen/train/G1094/hidden/court_hidden.clas.abap
Normal file
125
tasks_gen/train/G1094/hidden/court_hidden.clas.abap
Normal file
@@ -0,0 +1,125 @@
|
||||
CLASS {{p}}court_hidden DEFINITION PUBLIC FINAL CREATE PUBLIC
|
||||
FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
||||
PRIVATE SECTION.
|
||||
TYPES tt_court TYPE RANGE OF {{p}}court-court_id.
|
||||
METHODS run
|
||||
IMPORTING iv_date TYPE d
|
||||
it_court TYPE tt_court OPTIONAL
|
||||
RETURNING VALUE(rr_data) TYPE REF TO data.
|
||||
METHODS lines_of
|
||||
IMPORTING ir_data TYPE REF TO data
|
||||
RETURNING VALUE(rv_lines) TYPE i.
|
||||
METHODS value_of
|
||||
IMPORTING ir_data TYPE REF TO data
|
||||
iv_row TYPE i
|
||||
iv_col TYPE string
|
||||
RETURNING VALUE(rv_value) TYPE string.
|
||||
METHODS row_of
|
||||
IMPORTING ir_data TYPE REF TO data
|
||||
iv_court TYPE string
|
||||
RETURNING VALUE(rv_row) TYPE i.
|
||||
METHODS busy_courts_only FOR TESTING.
|
||||
METHODS quiet_courts_dropped FOR TESTING.
|
||||
METHODS one_day_only FOR TESTING.
|
||||
METHODS cancelled_ignored FOR TESTING.
|
||||
METHODS totals_per_court FOR TESTING.
|
||||
METHODS court_filter FOR TESTING.
|
||||
METHODS alphabetical_order FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
CLASS {{p}}court_hidden IMPLEMENTATION.
|
||||
METHOD run.
|
||||
cl_salv_bs_runtime_info=>set( display = abap_false metadata = abap_false data = abap_true ).
|
||||
SUBMIT {{p}}court_old WITH p_date = iv_date WITH s_court IN it_court AND RETURN.
|
||||
TRY.
|
||||
cl_salv_bs_runtime_info=>get_data_ref( IMPORTING r_data = rr_data ).
|
||||
CATCH cx_salv_bs_sc_runtime_info.
|
||||
ENDTRY.
|
||||
cl_salv_bs_runtime_info=>clear_all( ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD lines_of.
|
||||
FIELD-SYMBOLS <lt_data> TYPE STANDARD TABLE.
|
||||
IF ir_data IS BOUND.
|
||||
ASSIGN ir_data->* TO <lt_data>.
|
||||
rv_lines = lines( <lt_data> ).
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD value_of.
|
||||
FIELD-SYMBOLS <lt_data> TYPE STANDARD TABLE.
|
||||
IF ir_data IS BOUND.
|
||||
ASSIGN ir_data->* TO <lt_data>.
|
||||
ASSIGN <lt_data>[ iv_row ] TO FIELD-SYMBOL(<ls_line>).
|
||||
IF sy-subrc = 0.
|
||||
ASSIGN COMPONENT iv_col OF STRUCTURE <ls_line> TO FIELD-SYMBOL(<lv_value>).
|
||||
IF sy-subrc = 0.
|
||||
rv_value = condense( CONV string( <lv_value> ) ).
|
||||
ENDIF.
|
||||
ENDIF.
|
||||
ENDIF.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD row_of.
|
||||
DATA lv_lines TYPE i.
|
||||
lv_lines = lines_of( ir_data ).
|
||||
DO lv_lines TIMES.
|
||||
IF value_of( ir_data = ir_data iv_row = sy-index iv_col = `COURT` ) = iv_court.
|
||||
rv_row = sy-index.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
ENDDO.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD busy_courts_only.
|
||||
cl_abap_unit_assert=>assert_equals( exp = 2 act = lines_of( run( '20260401' ) ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD quiet_courts_dropped.
|
||||
DATA(lr_data) = run( '20260401' ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 0 act = row_of( ir_data = lr_data iv_court = 'C003' ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 0 act = row_of( ir_data = lr_data iv_court = 'C004' ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD one_day_only.
|
||||
DATA(lr_data) = run( '20260331' ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 1 act = lines_of( lr_data ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `C003` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `COURT` ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `2` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `BOOKINGS` ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `120` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `TOTAL_MIN` ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `40.00` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `CHARGE` ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD cancelled_ignored.
|
||||
DATA(lr_data) = run( '20260401' ).
|
||||
DATA(lv_row) = row_of( ir_data = lr_data iv_court = 'C002' ).
|
||||
cl_abap_unit_assert=>assert_differs( exp = 0 act = lv_row msg = 'court C002 missing' ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `2` act = value_of( ir_data = lr_data iv_row = lv_row iv_col = `BOOKINGS` ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `120` act = value_of( ir_data = lr_data iv_row = lv_row iv_col = `TOTAL_MIN` ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `32.00` act = value_of( ir_data = lr_data iv_row = lv_row iv_col = `CHARGE` ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD totals_per_court.
|
||||
DATA(lr_data) = run( '20260401' ).
|
||||
DATA(lv_row) = row_of( ir_data = lr_data iv_court = 'C001' ).
|
||||
cl_abap_unit_assert=>assert_differs( exp = 0 act = lv_row msg = 'court C001 missing' ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `2` act = value_of( ir_data = lr_data iv_row = lv_row iv_col = `BOOKINGS` ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `90` act = value_of( ir_data = lr_data iv_row = lv_row iv_col = `TOTAL_MIN` ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `18.00` act = value_of( ir_data = lr_data iv_row = lv_row iv_col = `CHARGE` ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD court_filter.
|
||||
DATA(lr_data) = run( iv_date = '20260401'
|
||||
it_court = VALUE #( ( sign = 'I' option = 'EQ' low = 'C001' ) ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 1 act = lines_of( lr_data ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `C001` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `COURT` ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `18.00` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `CHARGE` ) ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD alphabetical_order.
|
||||
DATA(lr_data) = run( '20260401' ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `C001` act = value_of( ir_data = lr_data iv_row = 1 iv_col = `COURT` ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = `C002` act = value_of( ir_data = lr_data iv_row = 2 iv_col = `COURT` ) ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
34
tasks_gen/train/G1094/mutation.json
Normal file
34
tasks_gen/train/G1094/mutation.json
Normal file
@@ -0,0 +1,34 @@
|
||||
{
|
||||
"task": "T31",
|
||||
"mutants": [
|
||||
{
|
||||
"object": "{{P}}COURT_OLD",
|
||||
"mutant": "line 44: <> -> = (rel) on booking_state 'X'",
|
||||
"status": "killed",
|
||||
"hidden": "0/7",
|
||||
"failed_tests": [
|
||||
"busy_courts_only",
|
||||
"quiet_courts_dropped",
|
||||
"one_day_only",
|
||||
"cancelled_ignored",
|
||||
"totals_per_court",
|
||||
"court_filter",
|
||||
"alphabetical_order"
|
||||
]
|
||||
},
|
||||
{
|
||||
"object": "{{P}}COURT_OLD",
|
||||
"mutant": "line 62: bookings < 2 -> bookings < 1 (rel)",
|
||||
"status": "killed",
|
||||
"hidden": "5/7",
|
||||
"failed_tests": [
|
||||
"busy_courts_only",
|
||||
"quiet_courts_dropped"
|
||||
]
|
||||
}
|
||||
],
|
||||
"valid": 2,
|
||||
"killed": 2,
|
||||
"kill_rate": 1.0,
|
||||
"ok": true
|
||||
}
|
||||
118
tasks_gen/train/G1094/reference/court_old.prog.abap
Normal file
118
tasks_gen/train/G1094/reference/court_old.prog.abap
Normal file
@@ -0,0 +1,118 @@
|
||||
REPORT {{p}}court_old.
|
||||
|
||||
TYPES: BEGIN OF ty_line,
|
||||
court TYPE {{p}}court-court_id,
|
||||
bookings TYPE i,
|
||||
total_min TYPE i,
|
||||
charge TYPE {{p}}court-hourly_rate,
|
||||
END OF ty_line.
|
||||
TYPES tt_line TYPE STANDARD TABLE OF ty_line WITH EMPTY KEY.
|
||||
TYPES tt_court TYPE RANGE OF {{p}}court-court_id.
|
||||
|
||||
DATA gv_court TYPE {{p}}court-court_id.
|
||||
|
||||
PARAMETERS p_date TYPE d OBLIGATORY.
|
||||
SELECT-OPTIONS s_court FOR gv_court.
|
||||
|
||||
CLASS lcl_report DEFINITION FINAL.
|
||||
PUBLIC SECTION.
|
||||
METHODS read_usage
|
||||
IMPORTING iv_date TYPE d
|
||||
it_court TYPE tt_court
|
||||
RETURNING VALUE(rt_lines) TYPE tt_line.
|
||||
METHODS show
|
||||
CHANGING ct_lines TYPE tt_line.
|
||||
ENDCLASS.
|
||||
|
||||
CLASS lcl_report IMPLEMENTATION.
|
||||
METHOD read_usage.
|
||||
SELECT c~court_id AS court,
|
||||
COUNT( * ) AS bookings,
|
||||
SUM( b~duration_min ) AS total_min,
|
||||
SUM( b~duration_min * c~hourly_rate / 60 ) AS charge
|
||||
FROM {{p}}booking AS b
|
||||
INNER JOIN {{p}}court AS c ON c~court_id = b~court_id
|
||||
WHERE b~booking_date = @iv_date
|
||||
AND b~booking_state <> 'X'
|
||||
AND b~court_id IN @it_court
|
||||
GROUP BY c~court_id
|
||||
ORDER BY c~court_id
|
||||
INTO CORRESPONDING FIELDS OF TABLE @rt_lines.
|
||||
|
||||
DELETE rt_lines WHERE bookings < 2.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD show.
|
||||
TRY.
|
||||
cl_salv_table=>factory( IMPORTING r_salv_table = DATA(lo_alv)
|
||||
CHANGING t_table = ct_lines ).
|
||||
lo_alv->display( ).
|
||||
CATCH cx_salv_msg INTO DATA(lx_error).
|
||||
MESSAGE lx_error TYPE 'I' DISPLAY LIKE 'E'.
|
||||
ENDTRY.
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
|
||||
START-OF-SELECTION.
|
||||
DATA(go_report) = NEW lcl_report( ).
|
||||
DATA(gt_lines) = go_report->read_usage( iv_date = p_date it_court = s_court[] ).
|
||||
go_report->show( CHANGING ct_lines = gt_lines ).
|
||||
|
||||
CLASS ltc_report DEFINITION FINAL FOR TESTING DURATION SHORT RISK LEVEL HARMLESS.
|
||||
PRIVATE SECTION.
|
||||
CLASS-DATA go_env TYPE REF TO if_osql_test_environment.
|
||||
CLASS-METHODS class_setup.
|
||||
CLASS-METHODS class_teardown.
|
||||
METHODS totals_per_court FOR TESTING.
|
||||
METHODS quiet_courts_dropped FOR TESTING.
|
||||
ENDCLASS.
|
||||
|
||||
CLASS ltc_report IMPLEMENTATION.
|
||||
METHOD class_setup.
|
||||
go_env = cl_osql_test_environment=>create(
|
||||
i_dependency_list = VALUE #( ( '{{P}}COURT' ) ( '{{P}}BOOKING' ) ) ).
|
||||
|
||||
DATA lt_court TYPE STANDARD TABLE OF {{p}}court WITH EMPTY KEY.
|
||||
lt_court = VALUE #(
|
||||
( court_id = 'A01' court_name = 'A Court' court_kind = 'I' hourly_rate = '12.00' )
|
||||
( court_id = 'B01' court_name = 'B Court' court_kind = 'O' hourly_rate = '20.00' ) ).
|
||||
go_env->insert_test_data( lt_court ).
|
||||
|
||||
DATA lt_booking TYPE STANDARD TABLE OF {{p}}booking WITH EMPTY KEY.
|
||||
lt_booking = VALUE #(
|
||||
( booking_id = 1 court_id = 'A01' booking_date = '20260401' duration_min = 60 booking_state = 'B' )
|
||||
( booking_id = 2 court_id = 'A01' booking_date = '20260401' duration_min = 30 booking_state = 'B' )
|
||||
( booking_id = 3 court_id = 'B01' booking_date = '20260401' duration_min = 60 booking_state = 'B' )
|
||||
( booking_id = 4 court_id = 'B01' booking_date = '20260401' duration_min = 60 booking_state = 'X' ) ).
|
||||
go_env->insert_test_data( lt_booking ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD class_teardown.
|
||||
go_env->destroy( ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD totals_per_court.
|
||||
DATA lv_court TYPE {{p}}court-court_id.
|
||||
DATA lv_expected TYPE {{p}}court-hourly_rate.
|
||||
lv_court = 'A01'.
|
||||
lv_expected = '18.00'.
|
||||
|
||||
DATA(lt_lines) = NEW lcl_report( )->read_usage( iv_date = '20260401' it_court = VALUE #( ) ).
|
||||
|
||||
cl_abap_unit_assert=>assert_equals( exp = 1 act = lines( lt_lines ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_court act = lt_lines[ 1 ]-court ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 2 act = lt_lines[ 1 ]-bookings ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = 90 act = lt_lines[ 1 ]-total_min ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_expected act = lt_lines[ 1 ]-charge ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD quiet_courts_dropped.
|
||||
DATA lv_court TYPE {{p}}court-court_id.
|
||||
lv_court = 'A01'.
|
||||
|
||||
DATA(lt_lines) = NEW lcl_report( )->read_usage( iv_date = '20260401' it_court = VALUE #( ) ).
|
||||
|
||||
cl_abap_unit_assert=>assert_equals( exp = 1 act = lines( lt_lines ) ).
|
||||
cl_abap_unit_assert=>assert_equals( exp = lv_court act = lt_lines[ 1 ]-court ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
14
tasks_gen/train/G1094/seed/booking.tabl.asabap
Normal file
14
tasks_gen/train/G1094/seed/booking.tabl.asabap
Normal file
@@ -0,0 +1,14 @@
|
||||
@EndUserText.label : 'Court bookings'
|
||||
@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE
|
||||
@AbapCatalog.tableCategory : #TRANSPARENT
|
||||
@AbapCatalog.deliveryClass : #A
|
||||
@AbapCatalog.dataMaintenance : #RESTRICTED
|
||||
define table {{p}}booking {
|
||||
key client : abap.clnt not null;
|
||||
key booking_id : abap.int4 not null;
|
||||
court_id : abap.char(4);
|
||||
member_id : abap.char(10);
|
||||
booking_date : abap.dats;
|
||||
duration_min : abap.int4;
|
||||
booking_state : abap.char(1);
|
||||
}
|
||||
12
tasks_gen/train/G1094/seed/court.tabl.asabap
Normal file
12
tasks_gen/train/G1094/seed/court.tabl.asabap
Normal file
@@ -0,0 +1,12 @@
|
||||
@EndUserText.label : 'Tennis courts'
|
||||
@AbapCatalog.enhancement.category : #NOT_EXTENSIBLE
|
||||
@AbapCatalog.tableCategory : #TRANSPARENT
|
||||
@AbapCatalog.deliveryClass : #A
|
||||
@AbapCatalog.dataMaintenance : #RESTRICTED
|
||||
define table {{p}}court {
|
||||
key client : abap.clnt not null;
|
||||
key court_id : abap.char(4) not null;
|
||||
court_name : abap.char(20);
|
||||
court_kind : abap.char(1);
|
||||
hourly_rate : abap.dec(9,2);
|
||||
}
|
||||
92
tasks_gen/train/G1094/seed/court_old.prog.abap
Normal file
92
tasks_gen/train/G1094/seed/court_old.prog.abap
Normal file
@@ -0,0 +1,92 @@
|
||||
REPORT {{p}}court_old.
|
||||
|
||||
TYPES: BEGIN OF ty_result,
|
||||
court TYPE {{p}}court-court_id,
|
||||
bookings TYPE i,
|
||||
total_min TYPE i,
|
||||
charge TYPE p LENGTH 11 DECIMALS 2,
|
||||
END OF ty_result.
|
||||
|
||||
DATA: gt_booking TYPE STANDARD TABLE OF {{p}}booking,
|
||||
gt_court TYPE STANDARD TABLE OF {{p}}court,
|
||||
gt_result TYPE STANDARD TABLE OF ty_result,
|
||||
gs_booking TYPE {{p}}booking,
|
||||
gs_court TYPE {{p}}court,
|
||||
gs_result TYPE ty_result,
|
||||
gs_next TYPE ty_result,
|
||||
gv_court TYPE {{p}}court-court_id,
|
||||
gv_fee TYPE p LENGTH 11 DECIMALS 2,
|
||||
gv_lines TYPE i,
|
||||
gv_outer TYPE i,
|
||||
gv_inner TYPE i,
|
||||
gv_i TYPE i,
|
||||
gv_j TYPE i,
|
||||
gv_k TYPE i,
|
||||
go_alv TYPE REF TO cl_salv_table.
|
||||
|
||||
PARAMETERS p_date TYPE d OBLIGATORY.
|
||||
SELECT-OPTIONS s_court FOR gv_court.
|
||||
|
||||
START-OF-SELECTION.
|
||||
|
||||
SELECT * FROM {{p}}court INTO TABLE gt_court.
|
||||
|
||||
SELECT * FROM {{p}}booking INTO TABLE gt_booking WHERE booking_date = p_date.
|
||||
|
||||
LOOP AT gt_booking INTO gs_booking.
|
||||
IF gs_booking-booking_state <> 'X'.
|
||||
IF gs_booking-court_id IN s_court.
|
||||
READ TABLE gt_court INTO gs_court WITH KEY court_id = gs_booking-court_id.
|
||||
IF sy-subrc = 0.
|
||||
CLEAR gv_fee.
|
||||
gv_fee = gs_booking-duration_min * gs_court-hourly_rate / 60.
|
||||
READ TABLE gt_result INTO gs_result WITH KEY court = gs_booking-court_id.
|
||||
IF sy-subrc = 0.
|
||||
gv_i = sy-tabix.
|
||||
gs_result-bookings = gs_result-bookings + 1.
|
||||
gs_result-total_min = gs_result-total_min + gs_booking-duration_min.
|
||||
gs_result-charge = gs_result-charge + gv_fee.
|
||||
MODIFY gt_result FROM gs_result INDEX gv_i.
|
||||
ELSE.
|
||||
CLEAR gs_result.
|
||||
gs_result-court = gs_booking-court_id.
|
||||
gs_result-bookings = 1.
|
||||
gs_result-total_min = gs_booking-duration_min.
|
||||
gs_result-charge = gv_fee.
|
||||
APPEND gs_result TO gt_result.
|
||||
ENDIF.
|
||||
ENDIF.
|
||||
ENDIF.
|
||||
ENDIF.
|
||||
ENDLOOP.
|
||||
|
||||
LOOP AT gt_result INTO gs_result.
|
||||
IF gs_result-bookings < 2.
|
||||
DELETE gt_result INDEX sy-tabix.
|
||||
ENDIF.
|
||||
ENDLOOP.
|
||||
|
||||
gv_lines = lines( gt_result ).
|
||||
gv_outer = gv_lines - 1.
|
||||
DO gv_outer TIMES.
|
||||
gv_i = sy-index.
|
||||
gv_inner = gv_lines - gv_i.
|
||||
DO gv_inner TIMES.
|
||||
gv_j = sy-index.
|
||||
gv_k = gv_j + 1.
|
||||
READ TABLE gt_result INTO gs_result INDEX gv_j.
|
||||
READ TABLE gt_result INTO gs_next INDEX gv_k.
|
||||
IF gs_next-court < gs_result-court.
|
||||
MODIFY gt_result FROM gs_next INDEX gv_j.
|
||||
MODIFY gt_result FROM gs_result INDEX gv_k.
|
||||
ENDIF.
|
||||
ENDDO.
|
||||
ENDDO.
|
||||
|
||||
TRY.
|
||||
cl_salv_table=>factory(
|
||||
IMPORTING r_salv_table = go_alv
|
||||
CHANGING t_table = gt_result ).
|
||||
go_alv->display( ).
|
||||
CATCH cx_salv_msg.
|
||||
ENDTRY.
|
||||
32
tasks_gen/train/G1094/seed/court_seed.clas.abap
Normal file
32
tasks_gen/train/G1094/seed/court_seed.clas.abap
Normal file
@@ -0,0 +1,32 @@
|
||||
CLASS {{p}}court_seed DEFINITION PUBLIC FINAL CREATE PUBLIC.
|
||||
PUBLIC SECTION.
|
||||
INTERFACES if_oo_adt_classrun.
|
||||
ENDCLASS.
|
||||
|
||||
CLASS {{p}}court_seed IMPLEMENTATION.
|
||||
METHOD if_oo_adt_classrun~main.
|
||||
DELETE FROM {{p}}booking.
|
||||
DELETE FROM {{p}}court.
|
||||
|
||||
INSERT {{p}}court FROM TABLE @( VALUE #(
|
||||
( court_id = 'C001' court_name = 'Centre Court' court_kind = 'I' hourly_rate = '12.00' )
|
||||
( court_id = 'C002' court_name = 'North Court' court_kind = 'O' hourly_rate = '16.00' )
|
||||
( court_id = 'C003' court_name = 'East Court' court_kind = 'I' hourly_rate = '20.00' )
|
||||
( court_id = 'C004' court_name = 'West Court' court_kind = 'O' hourly_rate = '10.00' ) ) ).
|
||||
|
||||
INSERT {{p}}booking FROM TABLE @( VALUE #(
|
||||
( booking_id = 1 court_id = 'C001' member_id = 'M01' booking_date = '20260401' duration_min = 60 booking_state = 'B' )
|
||||
( booking_id = 2 court_id = 'C001' member_id = 'M02' booking_date = '20260401' duration_min = 30 booking_state = 'B' )
|
||||
( booking_id = 3 court_id = 'C001' member_id = 'M03' booking_date = '20260401' duration_min = 60 booking_state = 'X' )
|
||||
( booking_id = 4 court_id = 'C002' member_id = 'M04' booking_date = '20260401' duration_min = 90 booking_state = 'B' )
|
||||
( booking_id = 5 court_id = 'C002' member_id = 'M05' booking_date = '20260401' duration_min = 30 booking_state = 'B' )
|
||||
( booking_id = 6 court_id = 'C002' member_id = 'M06' booking_date = '20260401' duration_min = 60 booking_state = 'X' )
|
||||
( booking_id = 7 court_id = 'C003' member_id = 'M07' booking_date = '20260401' duration_min = 60 booking_state = 'B' )
|
||||
( booking_id = 8 court_id = 'C004' member_id = 'M08' booking_date = '20260401' duration_min = 45 booking_state = 'B' )
|
||||
( booking_id = 9 court_id = 'C002' member_id = 'M09' booking_date = '20260331' duration_min = 60 booking_state = 'B' )
|
||||
( booking_id = 10 court_id = 'C003' member_id = 'M10' booking_date = '20260331' duration_min = 60 booking_state = 'B' )
|
||||
( booking_id = 11 court_id = 'C003' member_id = 'M11' booking_date = '20260331' duration_min = 60 booking_state = 'B' ) ) ).
|
||||
|
||||
out->write( sy-dbcnt ).
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
44
tasks_gen/train/G1094/spec.md
Normal file
44
tasks_gen/train/G1094/spec.md
Normal file
@@ -0,0 +1,44 @@
|
||||
# 1. Goal
|
||||
A tennis club rents out its courts by the hour. The club manager wants a daily
|
||||
overview of how busy each court was. The existing report {{P}}COURT_OLD in
|
||||
package $TMP already produces this overview, but its source has grown messy over
|
||||
the years. Rework the source so that the team can maintain it again. The output
|
||||
must not change.
|
||||
|
||||
# 2. Open questions
|
||||
None.
|
||||
|
||||
# 3. Context
|
||||
- {{P}}COURT holds the court master data: COURT_ID (CHAR 4, key),
|
||||
COURT_NAME (CHAR 20), COURT_KIND (CHAR 1), HOURLY_RATE (DEC 9,2).
|
||||
- {{P}}BOOKING holds the bookings: BOOKING_ID (INT4, key), COURT_ID (CHAR 4),
|
||||
MEMBER_ID (CHAR 10), BOOKING_DATE (DATS), DURATION_MIN (INT4),
|
||||
BOOKING_STATE (CHAR 1).
|
||||
- Both tables are in package $TMP and contain data.
|
||||
- {{P}}COURT_OLD is active. It is the object that you change.
|
||||
|
||||
# 4. Contract
|
||||
- {{P}}COURT_OLD remains an executable program in package $TMP with the same
|
||||
name.
|
||||
- The selection screen remains as it is today: P_DATE (DATS, obligatory) and
|
||||
S_COURT (select-option on the court).
|
||||
- The ALV list remains as it is today. Its columns are COURT, BOOKINGS,
|
||||
TOTAL_MIN and CHARGE. CHARGE is a packed number with two decimals.
|
||||
|
||||
# 5. Business rules
|
||||
The current source of {{P}}COURT_OLD defines what the report does. Read that
|
||||
source and keep every one of its rules. Do not add rules and do not remove
|
||||
rules. The figures, the rows and the order of the rows in the list must stay
|
||||
exactly the same for every input.
|
||||
|
||||
# 6. Constraints
|
||||
- Release target: SAP_BASIS 816 (ABAP Platform 2025).
|
||||
- Coding standards: Clean ABAP. Short methods. Same behavior. Same selection
|
||||
screen.
|
||||
- Out of scope: {{P}}COURT and {{P}}BOOKING.
|
||||
|
||||
# 7. Acceptance
|
||||
- {{P}}COURT_OLD is active and free of syntax errors.
|
||||
- The list that the report produces is unchanged.
|
||||
- The hidden tests pass.
|
||||
- Add ABAP Unit tests as local test classes in the program.
|
||||
73
tasks_gen/train/G1094/task.json
Normal file
73
tasks_gen/train/G1094/task.json
Normal file
@@ -0,0 +1,73 @@
|
||||
{
|
||||
"id": "G1094",
|
||||
"category": "E",
|
||||
"object_type": "PROG",
|
||||
"difficulty": 2,
|
||||
"release_target": "v816",
|
||||
"expected_outcome": "implement",
|
||||
"budget": {
|
||||
"max_tool_calls": 60,
|
||||
"max_activations": 15
|
||||
},
|
||||
"seed": [
|
||||
{
|
||||
"type": "TABL",
|
||||
"name": "{{P}}COURT",
|
||||
"file": "seed/court.tabl.asabap",
|
||||
"description": "Tennis court master data"
|
||||
},
|
||||
{
|
||||
"type": "TABL",
|
||||
"name": "{{P}}BOOKING",
|
||||
"file": "seed/booking.tabl.asabap",
|
||||
"description": "Court bookings"
|
||||
},
|
||||
{
|
||||
"type": "PROG",
|
||||
"name": "{{P}}COURT_OLD",
|
||||
"file": "seed/court_old.prog.abap",
|
||||
"description": "Legacy court usage report"
|
||||
},
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}COURT_SEED",
|
||||
"file": "seed/court_seed.clas.abap",
|
||||
"description": "Court and booking seed data",
|
||||
"run": true
|
||||
}
|
||||
],
|
||||
"contract": [
|
||||
{
|
||||
"type": "PROG",
|
||||
"name": "{{P}}COURT_OLD",
|
||||
"parameters": [
|
||||
"p_date",
|
||||
"s_court"
|
||||
]
|
||||
}
|
||||
],
|
||||
"out_of_scope": [
|
||||
"{{P}}COURT",
|
||||
"{{P}}BOOKING"
|
||||
],
|
||||
"hidden_tests": [
|
||||
{
|
||||
"type": "CLAS",
|
||||
"name": "{{P}}COURT_HIDDEN",
|
||||
"file": "hidden/court_hidden.clas.abap",
|
||||
"description": "Court usage hidden tests"
|
||||
}
|
||||
],
|
||||
"reference": [
|
||||
{
|
||||
"type": "PROG",
|
||||
"name": "{{P}}COURT_OLD",
|
||||
"file": "reference/court_old.prog.abap",
|
||||
"description": "Refactored court usage report"
|
||||
}
|
||||
],
|
||||
"craft_checks": [
|
||||
"db_operation_in_loop",
|
||||
"method_length"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user