-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathcomplete_code_migration.py
More file actions
57 lines (45 loc) · 2.27 KB
/
complete_code_migration.py
File metadata and controls
57 lines (45 loc) · 2.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/usr/bin/env python3
"""
Complete Code Migration: internal_marks → internal_score
Changes EVERYTHING including variables, form fields, JavaScript, etc.
"""
import glob
import re
import os
print('=== COMPLETE MIGRATION: internal_marks → internal_score ===\n')
# Files to update
files_to_update = ['app.py'] + glob.glob('templates/*.html')
for filepath in files_to_update:
print(f'Updating: {os.path.basename(filepath)}')
with open(filepath, 'r', encoding='utf-8') as f:
content = f.read()
# Replace ALL variations of internal_marks
content = content.replace('internal_marks', 'internal_score')
content = content.replace('Internal_Marks', 'Internal_Score')
content = content.replace('internal_Marks', 'internal_Score')
content = content.replace('Internal_marks', 'Internal_score')
# Replace JavaScript function names and variables
content = content.replace('updateInternal_Marks', 'updateInternal_Score')
content = content.replace('currentInternal_Marks', 'currentInternal_Score')
content = content.replace('updateInternal_Scores', 'updateInternal_Score')
content = content.replace('currentInternal_Scores', 'currentInternal_Score')
# Replace form field names and IDs
content = content.replace('name="internal_marks"', 'name="internal_score"')
content = content.replace('id="internal_marks"', 'id="internal_score"')
content = content.replace('internal_marks-percentage', 'internal_score-percentage')
# Replace any remaining references
content = re.sub(r'\binternal_marks\b', 'internal_score', content)
with open(filepath, 'w', encoding='utf-8') as f:
f.write(content)
print(f' ✅ {os.path.basename(filepath)} updated')
print('\n' + '='*60)
print('✅ COMPLETE MIGRATION FINISHED!')
print('='*60)
print('✅ Database columns: internal_marks → internal_score')
print('✅ Python variables: internal_marks → internal_score')
print('✅ Form fields: name="internal_marks" → name="internal_score"')
print('✅ JavaScript variables: internal_marks → internal_score')
print('✅ Function names: updateInternal_Marks → updateInternal_Score')
print('✅ IDs and classes: internal_marks → internal_score')
print('✅ EVERYTHING has been changed to internal_score!')
print('='*60)