Here is the sentence again:
He was instead flirting with pretty girls in the cafeteria is the first main clause. Needless to say, an introductory transition, begins the second main clause, he was inadequately prepared .... These two main clauses run together with no break, causing a fused sentence.
A period after cafeteria and a capital N for needless would fix the problem nicely.