Capacitor is either fully charged or fully discharged. Therer is no any condition in between the two.
Fully charged means q = q and fully discharged means q = 0
Changing of a capacitor is a continuous process. Therefore, small work done in terms of electrostatic potential,
Therefore, total work done in complete changing of a capacitor,
This work done is stored in the form of electrostatic potential energy of a capacitor.