I think the rule that whenever some action in the past stretches over a period of time one uses the imperfect is incomplete and often misleading. You use imperfect, whenever you want to stress the fact that an action took up considerable amount of time, often compared to another action. It's the same in English:
Yesterday I had a great time. -- Here you simply want to relate the fact.
I was having a great time. -- The stress is on the period of having a great time. The next sentence could say something like: "And then you showed up!" In French, the first part would be imperfect tense and the second passé composé.