Spells active for war if spell factory is being upgraded
It's a bit of a disadvantage if someone is upgrading their spell factory and they cannot use spells in war. It's similar to if they are upgrading defenses. If that spell factory level is calculated in the matchmaking, it should be usable during the war.
Obviously, they shouldn't be able to use the spells during a regular non war raid. This could be achieved by allowing them to create spells while it is being upgraded, but don't allow spells to show up as available while attacking.
So it's basically just a filter for regular raids that checks to see if spell factory is upgrading, and allow you to use spells only if it's not.