def get_cr_for_field_change(ts, field_change, current=False): """Given a filed_change, calculate a comparison result for that change. And the last run.""" if current: runs = get_current_runs_of_fieldchange(ts, field_change) else: runs = get_runs_of_fieldchange(ts, field_change) runs_all = list(runs.before) runs_all.extend(runs.after) ri = RunInfo(ts, [r.id for r in runs_all], only_tests=[field_change.test_id]) cr = ri.get_comparison_result(runs.after, runs.before, field_change.test.id, field_change.field, ts.Sample.get_hash_of_binary_field()) return cr, runs.after[0], runs_all