with open('app/modules/sag/templates/detail.html', 'r', encoding='utf-8') as f:
    text = f.read()

bad_str = """        } timer`;
            }
        }
        
        // Add listeners safely
        document.addEventListener('DOMContentLoaded', () => {
            bindTimeModalCalculations();           const solAddTime = document.getElementById('sol_add_time');"""

good_str = """        
        // Add listeners safely
        document.addEventListener('DOMContentLoaded', () => {
            bindTimeModalCalculations();
            const solAddTime = document.getElementById('sol_add_time');"""

text = text.replace(bad_str, good_str)
with open('app/modules/sag/templates/detail.html', 'w', encoding='utf-8') as f:
    f.write(text)
print("Fixed stray timer characters.")

