Create new test case and refactor production code.

create a new test case: test_pick_bag_by_obselete_ticket
and refactor production code.