add if condition to view_event