I saw something similar in the last legacy app I worked on. Bear in mind this was a single, monolithic, method embedded in a Windows form. It went like this....
Step 1:
Do For Each User Criteria Entry
Select a lot of rows from the database using unparameterized user entry
Loop through the results to load them in an array
Loop through this array doing a switch to determine which single row SQL to execute, loading the resulting data into a new array.
Clear out the original array.
Loop
Step 2:
Loop through the results array, adding/deleting values based on poorly documented business rules and deleting any duplicates.
Step 3:
Repeat of Step 1, using slightly different criteria on the switch SQL statements based on the business rule modifications. It was likely this code was cut and pasted from step 1 and modified.
Step 4:
Loop trough the results array again to delete any duplicates
Step 5:
Display the first record from the array (there was only supposed to be one record by this point but that didn't always happen)
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I saw something similar in the last legacy app I worked on. Bear in mind this was a single, monolithic, method embedded in a Windows form. It went like this....
Step 1:
Do For Each User Criteria Entry
Select a lot of rows from the database using unparameterized user entry
Loop through the results to load them in an array
Loop through this array doing a switch to determine which single row SQL to execute, loading the resulting data into a new array.
Clear out the original array.
Loop
Step 2:
Loop through the results array, adding/deleting values based on poorly documented business rules and deleting any duplicates.
Step 3:
Repeat of Step 1, using slightly different criteria on the switch SQL statements based on the business rule modifications. It was likely this code was cut and pasted from step 1 and modified.
Step 4:
Loop trough the results array again to delete any duplicates
Step 5:
Display the first record from the array (there was only supposed to be one record by this point but that didn't always happen)