Listening to your body when temptations arrive in the form of sugary treats
When we crave sugar there is a reason - it is glucose and glucose is our bodies primary fuel source for energy.
If we have had poor sleep, we are stressed or at different times of the menstrual cycle our body requires more energy than we are giving it.
If our bodies need more energy they are from a biological survival standpoint look for the most energy-rich food and crave it.
In these times identify what is creating this response in the body and treat the route cause not the symptom.
If you are tired - sleep.
If you are stressed - do some deep breathing.
If you are menstruating and in a calorie deficit maybe consider a less aggressive deficit for this point in your cycle or even a base load calories.
You do not lack determination: you lack the understanding of what your body is trying to tell you.