Here is an abstract from Le Petit Nicolas by Sempe and Goscinny that my French learning friend was studying:
Le photographe etait la, aussi, avec son appareil et la maitresse lui a dit qu'il fallait faire vite, sinon, nous allions rater notre cours d'arithmetique.
What is the tense of the verb in bold?
Despite being French myself, I couldn't answer my friend's question. At first, it has the "verbe aller+infinitif" of the futur proche, but the verb avoir is here conjugated at imparfait tense, so it doesn't work. Is there a specific name for that tense (futur proche du passe?) or is it just imparfait+infinitif?
What does this tense express?
The name of the tense is mostly a keyword for further researches. More interestingly is to understand its main usages. My explanation is that it is "the futur proche in a past context". Indeed, the narrator (Nicolas) tells an anecdote from his childhood, and the event related by "allions rater" happens shortly after the main related event (the photo), but still in the past from Nicolas' point of view. Is it a correct interpretation?
For example, since the clause is introduced by "sinon", could "allions rater" be replaced by a conditionel present? What is the nuance expressed with
[...] sinon, nous raterions notre cours d'arithmetique.