kishankrish19 commited on
Commit
5e16fc6
·
0 Parent(s):

Deploy MoM application

Browse files
.gitignore ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .venv/
2
+ __pycache__/
3
+ .pytest_cache/
4
+ data/
5
+ *.log
6
+ source_data.json
7
+ source_inspection.json
8
+ validation/ui-data/
9
+ validation/browser-report.xlsx
10
+ MOM_App.zip
11
+ *.xlsx
12
+ validation/*.png
PLAN.md ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # MOM application
2
+
3
+ 1. Read the two supplied reports as data and identify users, update sections and action dates.
4
+ 2. Build a Flask application with local SQLite storage, hashed passwords, fixed accounts and mandatory first-login password changes.
5
+ 3. Implement previous-action review, individually saved updates, dated new actions, submission and report history.
6
+ 4. Add administrator controls for meetings and accounts, Excel export and local database backup.
7
+ 5. Verify permissions, persistence, workflow, import/export and browser layout; supply a Windows launcher and operating instructions.
8
+
9
+ Completed: all five steps above. Verified with 16 automated tests and a real Edge browser workflow using an isolated database. Desktop and mobile layouts were visually inspected.
10
+
11
+ Final requirements: weekly Monday meetings; coordinator rotation is limited to Kishan, Harshitha, Gokul, Manish, Madhan, Honey and Madhav in that order. The coordinator enters all sections for other participants. A first-run upload page previews the old report's actions and owner mappings before confirmation. The user corrected the newer report's actual meeting date to 21 September 2026, prepared by Kishan. The first upcoming meeting is 28 September with Harshitha.
12
+
13
+ Decisions: Kishan is the administrator. September is the initial action baseline if the user selects the supplied source; August remains historical. All save operations use the database on this computer. No public registration or cloud service. Historical text is preserved; a textual deadline remains a note. New actions require a calendar date. The user can download the original reports unchanged.
14
+
15
+ Latest export correction: copy the prior workbook with its exact MOM and CLOSED sheet names and existing assets. Replace update rows per person and current-week new action rows, expanding/contracting and renumbering. Only completed prior actions append to CLOSED. Unfinished prior actions stay in SQLite/app history and never appear in the new Excel MOM sheet. Report preparation happens in the workweek after the Monday meeting. The action form permits the preceding working week through the next Monday. Regression tests validate archive preservation, week-to-week copies, empty weeks, serial numbering, date selection, and untouched ZIP parts.
README.md ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Local MOM workspace
2
+
3
+ A Python Flask application with browser pages and a local SQLite database. It needs no cloud services. After the initial package installation it works offline.
4
+
5
+ ## Start on this computer
6
+
7
+ Double-click **start_mom.bat**, then open **http://127.0.0.1:5000**. The supplied `.venv` already has the required packages. Keep the server window open while using the app. Restarting the app keeps all saved data.
8
+
9
+ On a different Windows computer, install Python 3.11 or newer, copy this project without `.venv`, and run `setup.bat` once. Then run `start_mom.bat`. A virtual environment is specific to its computer and should not be moved.
10
+
11
+ ## First login and setup
12
+
13
+ 1. Select **Kishan H M** and use **Password@123**. Every account starts with that password and must change it on first login.
14
+ 2. Choose a personal password with 10–128 characters, including uppercase, lowercase, a number and a symbol.
15
+ 3. The first-run setup page asks for the previous MOM Excel file. Upload it, inspect the extracted actions, match each name to a person, and enter the **actual old meeting date** and the upcoming Monday date. No import takes effect until you click **Confirm import**.
16
+ 4. You can alternatively choose **Use supplied report** to start with the report already included in this project.
17
+ 5. Select the coordinator for the upcoming meeting. Other users can begin after setup is complete.
18
+
19
+ The importer reads the first worksheet. It recognises `Updates from Name` sections and an action table with **Action/Actions in column B, Due Date in C, and Owner in D**, matching the supplied reports and this application's exports. `.xlsx` files up to 10 MB are supported. Formulas/macros are never executed. Unknown people can be matched manually or added as coordinator-managed participants with login disabled. Text deadlines such as “Daily,” “In Progress,” and “Waiting for Client” are preserved. If an exported workbook explicitly marks an action completed, it is not carried into the new checklist.
20
+
21
+ First-run import is intentionally available only before setup completes. Thereafter the app carries unfinished actions forward itself; weekly entries do not require re-importing Excel. Repeated confirmation cannot duplicate actions. Initial sample history for the same imported date is replaced after review. The uploaded original is retained under `data/imports`.
22
+
23
+ ## Weekly Monday workflow
24
+
25
+ The coordinator can choose **Coordinate meeting → Report preparation date** and select any Monday–Friday in the reporting week after the meeting. For example, the 28 September meeting offers 28 September–2 October. This preparation date is saved separately and shown in the app; the Excel meeting date stays on Monday to preserve the source layout. Selecting it does not change the meeting date or advance the coordinator rotation. Each new meeting starts with no preparation date selected.
26
+
27
+ Report preparation rotates only in this order:
28
+
29
+ 1. Kishan H M — `kishan`
30
+ 2. Harshitha P — `harshitha`
31
+ 3. Gokul M — `gokul`
32
+ 4. Manish J — `manish`
33
+ 5. Madhan D — `madhan`
34
+ 6. Honey S P — `honey`
35
+ 7. Madhav S — `madhav`
36
+
37
+ The coordinator prepared the 21 September report under Kishan's turn. The initial upcoming meeting is **Monday 28 September 2026**, with **Harshitha P** as coordinator. The app proposes the following Monday and next person when the coordinator finishes a meeting; it does not close meetings silently on a timer. If first used much later, choose the appropriate upcoming Monday in setup.
38
+
39
+ Each of the seven members reviews their own previous actions, adds updates one at a time, adds new actions with required dates, and submits. Every added item is immediately saved locally. Previous-action ticks save when **Save & continue** is pressed. You can edit or remove saved items before submission. Submitted entries can be reopened while the meeting is active. Unsubmitted saved entries appear in reports as drafts. New action dates can be selected from the preceding Monday through the following Monday, including the working-week dates shown in the action form.
40
+
41
+ The weekly coordinator uses **Coordinate meeting** to prepare complete entries for everyone outside the rotation, including action completion checks, updates and new actions. These entries retain the original person's name. Only the coordinator and Kishan as administrator can edit those entries. Members of the seven-person rotation cannot edit each other's entries. Coordinator permissions transfer automatically when the next meeting opens.
42
+
43
+ Additional accounts from the supplied reports: Shravan, Kamlakant, Vinay, Sunny, Rikki, Niranjan, and Pavan Sai. Their usernames are their lowercase first names. They can view reports; the weekly coordinator prepares their entries.
44
+
45
+ ## Reports and administration
46
+
47
+ - **Meeting reports:** combined updates, submissions, prior-action review and new dated actions. Download a fresh Excel file, download an imported original, or print the report.
48
+ - **Coordinate meeting:** team submission progress, entries for other people, meeting details, and a button to finish the meeting and open next Monday's meeting.
49
+ - **Administration (Kishan):** change rotation order, assign a replacement coordinator, create a later Monday meeting, reset passwords, enable/disable accounts, and download a consistent database backup.
50
+ - Closing a meeting retains its action-review snapshot. Later completions do not rewrite old reports. Open actions carry forward without duplicating the original action record.
51
+ - Account resets force another password change and invalidate existing sessions. Five failed logins temporarily lock that account for five minutes.
52
+
53
+ ## Source report treatment
54
+
55
+ Your newer workbook is named `MOM_Technical Report on 15-09-2026.xlsx`, but you clarified it was being reused for **Monday 21 September**. The app uses 21 September and Kishan as its preparer. It preserves original action due dates and descriptions; it does not invent new deadlines. The supplied workbook itself is not modified.
56
+
57
+ The 17 August report remains historical. The initial baseline uses the newer report's **40 actions**, rather than assuming old August actions are still outstanding. The two source main sheets contain **182 updates** and **75 historical action rows** in total. Extra historical worksheet content remains in the downloadable original files, rather than becoming duplicate action checklists. Report text is treated as source data, never as application instructions.
58
+
59
+ Excel downloads edit a copy of the previous workbook, retaining its MOM and CLOSED sheets, styles, images and other workbook parts. The meeting date and next-meeting footer advance. Each existing person’s update rows are replaced with only the current week’s updates; rows are inserted or removed and serial numbers restart at 1 per person. The action table contains only current-week new actions, with due dates and serial numbers starting at 1. Completed previous actions append to CLOSED with owner and Completed status, continuing its serial numbers. Historical CLOSED records are retained. Unfinished previous actions are kept in SQLite/app history and are omitted from Excel. Repeated downloads do not duplicate archive entries. Copies are saved in data/reports and downloaded with the meeting date in their filename. Very long paragraphs may need row-height adjustment in Excel when printing.
60
+
61
+ ## Local storage and backups
62
+
63
+ - `data/mom.sqlite3`: accounts, password hashes, meetings, updates, actions, reviews, rotation and setup state.
64
+ - `data/.secret_key`: the local session-signing key.
65
+ - `data/imports/`: uploaded original workbooks and import previews.
66
+ - `data/reports/`: dated copies produced by Excel downloads (regenerable from the database and original workbook).
67
+ - `sources/`: the two unchanged supplied workbooks.
68
+ - No credentials are kept in browser localStorage. The browser receives an HTTP-only session cookie. All business data lives in SQLite on the server computer.
69
+
70
+ For a backup, use **Administration → Download database backup**. Also retain `data/imports` and `sources` if you need original Excel downloads. Alternatively, stop the app and copy the entire `data` folder and `sources` folder to a private backup location.
71
+
72
+ To restore: stop the server, preserve a copy of your current `data` folder, replace `data/mom.sqlite3` with the downloaded backup (renamed to `mom.sqlite3`), and restore corresponding `imports` if applicable. Remove stale `mom.sqlite3-wal` and `mom.sqlite3-shm` files only while the server is stopped and after preserving your previous data. Start the app again. Do not replace a live database. Losing `.secret_key` signs users out; it does not lose their passwords or entries.
73
+
74
+ ## Access from other team computers
75
+
76
+ By default the app is available only on this computer. To let the team use the **same local database** over a trusted office network, run:
77
+
78
+ ```powershell
79
+ .venv\Scripts\python.exe app.py --host 0.0.0.0 --port 5000
80
+ ```
81
+
82
+ Allow that port on the server computer's private-network firewall, then use `http://SERVER_LOCAL_IP:5000` from team browsers. The server computer must remain on. Data stays on that computer. Running a separate copy on every member's PC would create separate databases. Do not expose this default HTTP configuration to the public internet. Use HTTPS and `MOM_HTTPS=1` for a TLS-hosted installation.
83
+
84
+ ## Development and verification
85
+
86
+ ```powershell
87
+ .venv\Scripts\python.exe -m pip install -r requirements-dev.txt
88
+ .venv\Scripts\python.exe -m pytest -q
89
+ ```
90
+
91
+ Tests use temporary databases and do not modify real accounts. Coverage includes password change gates, CSRF, permissions, local persistence, action review, item edits, date validation, idempotent saves, weekly rotation, historical snapshots, upload preview/confirmation, coordinator delegation, Excel exports, backup and account resets.
92
+
93
+ Main files: `app.py` (routes and permissions), `schema.sql` (database), `seed.py` (initial data/rotation), `importer.py` and `setup_routes.py` (first-run import), `exporter.py` (Excel download), `templates/` and `static/` (frontend). Set `MOM_DATA_DIR` to choose a different local data directory, and optionally `MOM_SECRET_KEY` to supply the session secret. This does not require an external database.
app.py ADDED
@@ -0,0 +1,582 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Local MOM application. Run python app.py, then open http://127.0.0.1:5000."""
2
+ from datetime import date, timedelta
3
+ from functools import wraps
4
+ from io import BytesIO
5
+ from pathlib import Path
6
+ import os
7
+ import re
8
+ import secrets
9
+ import sqlite3
10
+ import tempfile
11
+ import time
12
+
13
+ from flask import Flask, abort, flash, g, redirect, render_template, request, send_file, session, url_for
14
+ from werkzeug.security import check_password_hash, generate_password_hash
15
+ from seed import DEFAULT_PASSWORD, create_meeting, seed_database, migrate_weekly, next_coordinator
16
+
17
+ ROOT = Path(__file__).resolve().parent
18
+
19
+ def preparation_days(meeting_date):
20
+ """The meeting's Monday-Friday reporting week, after the meeting."""
21
+ monday=date.fromisoformat(meeting_date)
22
+ return [monday+timedelta(days=offset) for offset in range(5)]
23
+
24
+ def create_app(test_config=None):
25
+ app = Flask(__name__)
26
+ data_dir = Path(os.environ.get('MOM_DATA_DIR', ROOT / 'data'))
27
+ app.config.update(DATABASE=str(data_dir/'mom.sqlite3'), SECRET_KEY=os.environ.get('MOM_SECRET_KEY'),
28
+ MAX_CONTENT_LENGTH=11*1024*1024, SESSION_COOKIE_HTTPONLY=True, REQUIRE_SETUP=True,
29
+ SESSION_COOKIE_SAMESITE='Lax', PERMANENT_SESSION_LIFETIME=timedelta(hours=8),
30
+ SESSION_COOKIE_SECURE=os.environ.get('MOM_HTTPS')=='1')
31
+ if test_config:
32
+ app.config.update(test_config)
33
+ Path(app.config['DATABASE']).parent.mkdir(parents=True, exist_ok=True)
34
+ if not app.config['SECRET_KEY']:
35
+ secret_file = Path(app.config['DATABASE']).parent/'.secret_key'
36
+ try:
37
+ with secret_file.open('x', encoding='ascii') as handle:
38
+ handle.write(secrets.token_hex(32))
39
+ except FileExistsError:
40
+ pass
41
+ app.config['SECRET_KEY'] = secret_file.read_text(encoding='ascii').strip()
42
+
43
+ def db():
44
+ if 'db' not in g:
45
+ g.db = sqlite3.connect(app.config['DATABASE'], timeout=20)
46
+ g.db.row_factory = sqlite3.Row
47
+ g.db.execute('PRAGMA foreign_keys=ON')
48
+ g.db.execute('PRAGMA journal_mode=WAL')
49
+ return g.db
50
+
51
+ @app.teardown_appcontext
52
+ def close_db(error=None):
53
+ connection = g.pop('db', None)
54
+ if connection is not None:
55
+ connection.close()
56
+
57
+ with app.app_context():
58
+ db().executescript((ROOT/'schema.sql').read_text())
59
+ migrate_weekly(db())
60
+ seed_database(db(), ROOT/'seed_data.json')
61
+ migrate_weekly(db())
62
+
63
+ def csrf():
64
+ if 'csrf' not in session:
65
+ session['csrf'] = secrets.token_hex(32)
66
+ return session['csrf']
67
+
68
+ @app.context_processor
69
+ def context():
70
+ current=db().execute("SELECT * FROM meetings WHERE status='active'").fetchone() if g.get('user') else None
71
+ can_coordinate=bool(g.get('user') and current and (g.user['is_admin'] or current['coordinator_id']==g.user['id']))
72
+ return dict(csrf_token=csrf, today=date.today().isoformat(), token=lambda:secrets.token_hex(20),can_coordinate=can_coordinate)
73
+
74
+ @app.template_filter('datefmt')
75
+ def datefmt(value):
76
+ return date.fromisoformat(value[:10]).strftime('%d %b %Y') if value else 'No date'
77
+
78
+ @app.before_request
79
+ def protect():
80
+ g.user = None
81
+ if session.get('user_id'):
82
+ g.user = db().execute('SELECT * FROM users WHERE id=? AND active=1',(session['user_id'],)).fetchone()
83
+ if not g.user or g.user['session_version'] != session.get('version'):
84
+ session.clear()
85
+ g.user = None
86
+ if request.method=='POST':
87
+ supplied = request.form.get('csrf_token','')
88
+ if not supplied or not secrets.compare_digest(supplied, session.get('csrf','')):
89
+ abort(400, 'Your form expired. Reload the page and try again.')
90
+ # Serialize writes so closing a meeting cannot race with a stale save.
91
+ db().execute('BEGIN IMMEDIATE')
92
+ if request.endpoint in ('login','static') or request.endpoint is None:
93
+ return
94
+ if not g.user:
95
+ return redirect(url_for('login'))
96
+ if g.user['must_change'] and request.endpoint not in ('password','logout'):
97
+ return redirect(url_for('password'))
98
+ if app.config['REQUIRE_SETUP'] and request.endpoint not in ('setup','password','logout') and not db().execute("SELECT 1 FROM metadata WHERE key='setup_complete'").fetchone():
99
+ if g.user['is_admin']:
100
+ return redirect(url_for('setup'))
101
+ return render_template('setup_waiting.html')
102
+
103
+ @app.after_request
104
+ def headers(response):
105
+ response.headers['X-Content-Type-Options']='nosniff'
106
+ response.headers['X-Frame-Options']='DENY'
107
+ response.headers['Referrer-Policy']='same-origin'
108
+ response.headers['Content-Security-Policy']="default-src 'self'; style-src 'self'; script-src 'self'; img-src 'self' data:; base-uri 'self'; form-action 'self'; frame-ancestors 'none'"
109
+ if request.endpoint != 'static':
110
+ response.headers['Cache-Control']='no-store'
111
+ return response
112
+
113
+ def admin_only(fn):
114
+ @wraps(fn)
115
+ def inner(*args,**kwargs):
116
+ if not g.user or not g.user['is_admin']:
117
+ abort(403)
118
+ return fn(*args,**kwargs)
119
+ return inner
120
+
121
+ def active_meeting():
122
+ meeting = db().execute("SELECT * FROM meetings WHERE status='active'").fetchone()
123
+ if not meeting:
124
+ abort(409,'There is no active meeting. Ask Kishan to create one.')
125
+ return meeting
126
+
127
+ from setup_routes import register_setup
128
+ register_setup(app,db,admin_only)
129
+
130
+ def entry_person():
131
+ uid=request.args.get('person',str(g.user['id']))
132
+ person=db().execute('SELECT * FROM users WHERE id=?',(uid,)).fetchone()
133
+ if not person:
134
+ abort(404)
135
+ if person['id']!=g.user['id']:
136
+ current=active_meeting()
137
+ if person['rotation_order'] is not None or not (g.user['is_admin'] or current['coordinator_id']==g.user['id']):
138
+ abort(403,'Only this week’s coordinator can enter reports for people outside the rotation.')
139
+ elif person['rotation_order'] is None and not g.user['is_admin']:
140
+ abort(403,'This week’s report coordinator handles your action review, updates and new actions. You can view them in Meeting reports.')
141
+ return person
142
+
143
+ def flow_url(step):
144
+ person=entry_person()
145
+ return url_for('workflow',step=step,person=person['id'] if person['id']!=g.user['id'] else None)
146
+
147
+ def submission(mid,uid=None):
148
+ return db().execute('SELECT * FROM submissions WHERE meeting_id=? AND user_id=?',(mid,uid if uid is not None else g.user['id'])).fetchone()
149
+
150
+ def editable():
151
+ meeting = active_meeting()
152
+ if request.method=='POST' and request.form.get('meeting_id') != str(meeting['id']):
153
+ abort(409,'The active meeting changed. Reload before saving.')
154
+ sub = submission(meeting['id'],entry_person()['id'])
155
+ if sub and sub['submitted_at']:
156
+ abort(409,'Your entry is submitted. Choose Edit submission from the dashboard first.')
157
+ return meeting
158
+
159
+ def text_field(name,limit=3000):
160
+ value=request.form.get(name,'').strip()
161
+ if not value or len(value)>limit or any(ord(c)<32 and c not in '\n\r\t' for c in value):
162
+ raise ValueError(f'Enter {name.replace("_"," ")} between 1 and {limit} characters.')
163
+ return value
164
+
165
+ def date_field(name):
166
+ value=request.form.get(name,'')
167
+ if not re.fullmatch(r'\d{4}-\d{2}-\d{2}',value):
168
+ raise ValueError('Choose a valid date.')
169
+ try:
170
+ return date.fromisoformat(value).isoformat()
171
+ except ValueError:
172
+ raise ValueError('Choose a valid date.') from None
173
+
174
+ def entry_token():
175
+ value = request.form.get('entry_token','')
176
+ if not re.fullmatch('[a-f0-9]{40}',value):
177
+ abort(400,'Invalid form. Reload and try again.')
178
+ return value
179
+
180
+ @app.route('/login',methods=['GET','POST'])
181
+ def login():
182
+ if g.user:
183
+ return redirect(url_for('dashboard'))
184
+ if request.method=='POST':
185
+ user=db().execute('SELECT * FROM users WHERE username=? AND active=1',(request.form.get('username','').strip(),)).fetchone()
186
+ if user and user['locked_until']>time.time():
187
+ flash('Too many attempts. Please try again in five minutes.','error')
188
+ elif user and check_password_hash(user['password_hash'],request.form.get('password','')):
189
+ db().execute('UPDATE users SET failed_attempts=0,locked_until=0 WHERE id=?',(user['id'],))
190
+ db().commit()
191
+ session.clear()
192
+ session.update(user_id=user['id'],version=user['session_version'])
193
+ session.permanent=True
194
+ return redirect(url_for('password' if user['must_change'] else 'dashboard'))
195
+ else:
196
+ if user:
197
+ attempts=(user['failed_attempts'] if user['locked_until']==0 else 0)+1
198
+ db().execute('UPDATE users SET failed_attempts=?,locked_until=? WHERE id=?',(attempts,time.time()+300 if attempts>=5 else 0,user['id']))
199
+ db().commit()
200
+ flash('The username or password is incorrect.','error')
201
+ return render_template('login.html', users=db().execute('SELECT name,username FROM users WHERE active=1 ORDER BY name').fetchall())
202
+
203
+ @app.post('/logout')
204
+ def logout():
205
+ session.clear()
206
+ return redirect(url_for('login'))
207
+
208
+ @app.route('/password',methods=['GET','POST'])
209
+ def password():
210
+ if request.method=='POST':
211
+ new=request.form.get('new_password','')
212
+ if not check_password_hash(g.user['password_hash'],request.form.get('current_password','')):
213
+ flash('Your current password is incorrect.','error')
214
+ elif len(new)<10 or len(new)>128 or not all((re.search('[A-Z]',new),re.search('[a-z]',new),re.search('[0-9]',new),re.search(r'[^A-Za-z0-9]',new))):
215
+ flash('Use 10–128 characters with uppercase, lowercase, a number and a symbol.','error')
216
+ elif new==DEFAULT_PASSWORD or check_password_hash(g.user['password_hash'],new):
217
+ flash('Choose a password different from your current and default password.','error')
218
+ elif new!=request.form.get('confirm_password'):
219
+ flash('The new passwords do not match.','error')
220
+ else:
221
+ db().execute('UPDATE users SET password_hash=?,must_change=0,session_version=session_version+1 WHERE id=?',(generate_password_hash(new),g.user['id']))
222
+ db().commit()
223
+ session['version']=g.user['session_version']+1
224
+ flash('Your password has been changed.','success')
225
+ return redirect(url_for('dashboard'))
226
+ return render_template('password.html')
227
+
228
+ @app.get('/')
229
+ def dashboard():
230
+ meeting=active_meeting()
231
+ uid=g.user['id']
232
+ stats=dict(db().execute('SELECT COUNT(*) total,COALESCE(SUM(r.completed),0) completed FROM reviews r JOIN actions a ON a.id=r.action_id WHERE r.meeting_id=? AND a.user_id=?',(meeting['id'],uid)).fetchone())
233
+ stats['updates']=db().execute('SELECT COUNT(*) FROM updates WHERE meeting_id=? AND user_id=?',(meeting['id'],uid)).fetchone()[0]
234
+ stats['actions']=db().execute('SELECT COUNT(*) FROM actions WHERE meeting_id=? AND user_id=?',(meeting['id'],uid)).fetchone()[0]
235
+ recent=db().execute('SELECT * FROM meetings ORDER BY meeting_date DESC LIMIT 5').fetchall()
236
+ team=db().execute('SELECT COUNT(*) FROM submissions WHERE meeting_id=? AND submitted_at IS NOT NULL',(meeting['id'],)).fetchone()[0]
237
+ total=db().execute('SELECT COUNT(*) FROM users WHERE active=1').fetchone()[0]
238
+ coordinator=db().execute('SELECT name FROM users WHERE id=?',(meeting['coordinator_id'],)).fetchone()
239
+ return render_template('dashboard.html',meeting=meeting,coordinator=coordinator,stats=stats,sub=submission(meeting['id']),recent=recent,team=team,total=total)
240
+
241
+ @app.post('/reopen')
242
+ def reopen():
243
+ meeting=active_meeting()
244
+ if request.form.get('meeting_id') != str(meeting['id']):
245
+ abort(409)
246
+ person=entry_person()
247
+ db().execute('UPDATE submissions SET submitted_at=NULL WHERE meeting_id=? AND user_id=?',(meeting['id'],person['id']))
248
+ db().commit()
249
+ return redirect(flow_url(1))
250
+
251
+ @app.route('/entry/<int:step>',methods=['GET','POST'])
252
+ def workflow(step):
253
+ if step not in (1,2,3,4):
254
+ abort(404)
255
+ meeting=editable()
256
+ person=entry_person()
257
+ mid,uid=meeting['id'],person['id']
258
+ meeting_day=date.fromisoformat(meeting['meeting_date'])
259
+ action_min=(meeting_day-timedelta(days=7)).isoformat()
260
+ action_max=(meeting_day+timedelta(days=7)).isoformat()
261
+ skipped_action_lines=[]
262
+ sub=submission(mid,uid)
263
+ if step>1 and (not sub or not sub['reviewed']):
264
+ flash('Review your previous actions first.','info')
265
+ return redirect(flow_url(1))
266
+ previous=db().execute('SELECT a.*,r.completed AS checked,m.meeting_date AS source_date FROM reviews r JOIN actions a ON a.id=r.action_id JOIN meetings m ON m.id=a.meeting_id WHERE r.meeting_id=? AND a.user_id=? ORDER BY a.due_date IS NULL,a.due_date,a.id',(mid,uid)).fetchall()
267
+ if request.method=='POST':
268
+ try:
269
+ if step==1:
270
+ selected=set(request.form.getlist('completed'))
271
+ allowed={str(a['id']) for a in previous}
272
+ if not selected.issubset(allowed):
273
+ abort(403)
274
+ for a in previous:
275
+ checked=int(str(a['id']) in selected)
276
+ db().execute('UPDATE reviews SET completed=? WHERE meeting_id=? AND action_id=?',(checked,mid,a['id']))
277
+ db().execute('UPDATE actions SET completed=? WHERE id=?',(checked,a['id']))
278
+ db().execute('INSERT INTO submissions(meeting_id,user_id,reviewed) VALUES(?,?,1) ON CONFLICT(meeting_id,user_id) DO UPDATE SET reviewed=1',(mid,uid))
279
+ db().commit()
280
+ return redirect(flow_url(2))
281
+ if step in (2,3):
282
+ table='updates' if step==2 else 'actions'
283
+ op=request.form.get('operation','add')
284
+ if op=='next':
285
+ return redirect(flow_url(step+1))
286
+ if op not in ('add','edit','delete'):
287
+ abort(400)
288
+ if op in ('edit','delete'):
289
+ item=db().execute(f'SELECT * FROM {table} WHERE id=? AND meeting_id=? AND user_id=?',(request.form.get('item_id'),mid,uid)).fetchone()
290
+ if not item:
291
+ abort(404)
292
+ if op=='delete':
293
+ db().execute(f'DELETE FROM {table} WHERE id=?',(item['id'],))
294
+ else:
295
+ submitted_bodies=request.form.getlist('body')
296
+ body=text_field('body')
297
+ submitted_dates=request.form.getlist('due_date')
298
+ due=date_field('due_date') if step==3 and request.form.get('due_date') else None
299
+ if step==3 and request.form.get('action_entry_mode')!='bulk' and not due:
300
+ raise ValueError('Choose a due date.')
301
+ if due and not action_min<=due<=action_max:
302
+ raise ValueError('Choose a due date from the working week before this meeting through the next meeting.')
303
+ if step==2:
304
+ duplicate_rows=db().execute('SELECT body FROM updates WHERE meeting_id=? AND user_id=? AND id!=?',(mid,uid,item['id'] if op=='edit' else -1)).fetchall()
305
+ existing={row['body'] for row in duplicate_rows}
306
+ if request.form.get('entry_mode')=='bulk' or '\n' in body or '\r' in body:
307
+ entries=[entry.strip() for submitted_body in submitted_bodies for entry in submitted_body.splitlines() if entry.strip()]
308
+ else:
309
+ entries=[body]
310
+ if request.form.get('entry_mode')=='bulk' or '\n' in body or '\r' in body or len(submitted_bodies)>1:
311
+ entries=list(dict.fromkeys(entry for entry in entries if entry not in existing))
312
+ if not entries:
313
+ raise ValueError('All of these updates already exist for this meeting.')
314
+ elif entries[0] in existing:
315
+ raise ValueError('An update with the same text already exists for this meeting.')
316
+ if op=='edit':
317
+ db().execute(f'UPDATE {table} SET body=? WHERE id=?',(body,item['id']))
318
+ if step==3:
319
+ db().execute('UPDATE actions SET due_date=? WHERE id=?',(due,item['id']))
320
+ else:
321
+ if step==2:
322
+ entries=[entry.strip() for submitted_body in submitted_bodies for entry in submitted_body.splitlines() if entry.strip()] if request.form.get('entry_mode')=='bulk' or '\n' in body or '\r' in body or len(submitted_bodies)>1 else [body]
323
+ if len(entries)>100:
324
+ raise ValueError('You can add up to 100 updates at once.')
325
+ bulk_token=entry_token()
326
+ for index,entry in enumerate(entries):
327
+ db().execute('INSERT INTO updates(meeting_id,user_id,body,entry_token) VALUES(?,?,?,?) ON CONFLICT(entry_token) DO NOTHING',(mid,uid,entry,f'{bulk_token}-{index}'))
328
+ else:
329
+ action_entries=[]
330
+ for index,submitted_body in enumerate(submitted_bodies):
331
+ match=re.match(r'^\s*\d+\.\s*(?:\[(.*?)\]|(.*?))\s*(?:\[(.*?)\])?\s*$',submitted_body)
332
+ if match:
333
+ action_body=(match.group(1) or match.group(2)).strip()
334
+ action_value=(match.group(3) or '').strip()
335
+ action_due=action_value if re.fullmatch(r'\d{4}-\d{2}-\d{2}',action_value) else None
336
+ if action_due:
337
+ date.fromisoformat(action_due)
338
+ action_entries.append((action_body,action_due,'' if action_due else action_value))
339
+ else:
340
+ action_entries.append((submitted_body.strip(),submitted_dates[index] if index<len(submitted_dates) else due,''))
341
+ if len(action_entries)>1:
342
+ bulk_token=entry_token()
343
+ saved_actions=0
344
+ for index,(action_body,action_due,action_note) in enumerate(action_entries):
345
+ if not action_body:
346
+ skipped_action_lines.append(index+1)
347
+ continue
348
+ if not action_min<=action_due<=action_max:
349
+ skipped_action_lines.append(index+1)
350
+ continue
351
+ db().execute('INSERT INTO actions(meeting_id,user_id,body,due_date,due_note,entry_token) VALUES(?,?,?,?,?,?) ON CONFLICT(entry_token) DO NOTHING',(mid,uid,action_body,action_due,action_note,f'{bulk_token}-{index}'))
352
+ saved_actions+=1
353
+ if not saved_actions:
354
+ raise ValueError('No actions had dates in the allowed range.')
355
+ else:
356
+ db().execute('INSERT INTO actions(meeting_id,user_id,body,due_date,entry_token) VALUES(?,?,?,?,?) ON CONFLICT(entry_token) DO NOTHING',(mid,uid,body,due,entry_token()))
357
+ db().commit()
358
+ if skipped_action_lines:
359
+ flash(f'Saved valid actions. Skipped lines {", ".join(map(str,skipped_action_lines))}; dates must be from {action_min} through {action_max}.','info')
360
+ else:
361
+ flash('Saved. You can add another item.','success')
362
+ return redirect(flow_url(step))
363
+ if step==4:
364
+ db().execute('UPDATE submissions SET submitted_at=CURRENT_TIMESTAMP WHERE meeting_id=? AND user_id=?',(mid,uid))
365
+ db().commit()
366
+ flash(f"Meeting entry for {person['name']} has been submitted.",'success')
367
+ return redirect(url_for('coordinator' if person['id']!=g.user['id'] else 'dashboard'))
368
+ except ValueError as error:
369
+ db().rollback()
370
+ flash(str(error),'error')
371
+ updates=db().execute('SELECT * FROM updates WHERE meeting_id=? AND user_id=? ORDER BY id',(mid,uid)).fetchall()
372
+ actions=db().execute('SELECT * FROM actions WHERE meeting_id=? AND user_id=? ORDER BY id',(mid,uid)).fetchall()
373
+ return render_template('workflow.html',step=step,meeting=meeting,previous=previous,updates=updates,actions=actions,entry_user=person,flow_url=flow_url,action_min=action_min,action_max=action_max)
374
+
375
+ def report_data(mid):
376
+ meeting=db().execute('SELECT * FROM meetings WHERE id=?',(mid,)).fetchone()
377
+ if not meeting:
378
+ abort(404)
379
+ users=db().execute('SELECT u.id,u.name,u.rotation_order,s.submitted_at,s.reviewed FROM users u LEFT JOIN submissions s ON s.user_id=u.id AND s.meeting_id=? ORDER BY u.name',(mid,)).fetchall()
380
+ updates=db().execute('SELECT x.*,u.name FROM updates x JOIN users u ON u.id=x.user_id WHERE meeting_id=? ORDER BY u.name,x.id',(mid,)).fetchall()
381
+ actions=db().execute('SELECT a.*,u.name FROM actions a JOIN users u ON u.id=a.user_id WHERE meeting_id=? ORDER BY u.name,a.id',(mid,)).fetchall()
382
+ reviews=db().execute('SELECT a.*,u.name,r.completed AS checked,m.meeting_date AS source_date FROM reviews r JOIN actions a ON a.id=r.action_id JOIN users u ON u.id=a.user_id JOIN meetings m ON m.id=a.meeting_id WHERE r.meeting_id=? ORDER BY u.name,a.id',(mid,)).fetchall()
383
+ source_label=meeting['source_file']
384
+ if source_label and source_label.startswith('upload:'):
385
+ source_label='Uploaded previous MOM report'
386
+ return dict(meeting=meeting,source_label=source_label,users=users,updates=updates,actions=actions,reviews=reviews)
387
+
388
+ @app.get('/reports')
389
+ def reports():
390
+ meetings=db().execute('SELECT m.*,(SELECT COUNT(*) FROM updates WHERE meeting_id=m.id) update_count,(SELECT COUNT(*) FROM actions WHERE meeting_id=m.id) action_count FROM meetings m ORDER BY meeting_date DESC').fetchall()
391
+ return render_template('reports.html',meetings=meetings)
392
+
393
+ @app.get('/reports/<int:mid>')
394
+ def report(mid):
395
+ return render_template('report.html',**report_data(mid))
396
+
397
+ @app.get('/reports/<int:mid>/excel')
398
+ def excel(mid):
399
+ from exporter import export_report
400
+ # Build the whole weekly copy from one consistent database snapshot.
401
+ db().execute('BEGIN')
402
+ data=report_data(mid)
403
+ baseline=db().execute('SELECT * FROM meetings WHERE source_file IS NOT NULL AND meeting_date<=? ORDER BY meeting_date DESC LIMIT 1',(data['meeting']['meeting_date'],)).fetchone()
404
+ if not baseline:abort(409,'Upload the previous Excel report before exporting.')
405
+ source=baseline['source_file']
406
+ if source.startswith('upload:'):
407
+ name=source.removeprefix('upload:')
408
+ if not re.fullmatch(r'[a-f0-9]{32}\.xlsx',name):abort(409,'The source workbook reference is invalid.')
409
+ source_path=Path(app.config['DATABASE']).parent/'imports'/name
410
+ else:
411
+ source_path=ROOT/'sources'/Path(source).name
412
+ if not source_path.exists():abort(409,'The previous workbook is missing. Restore its original file from your backup.')
413
+ previous=source_path.read_bytes()
414
+ style_workbook=previous
415
+ aliases={r['source_name']:r['user_id'] for r in db().execute('SELECT * FROM report_owner_aliases WHERE meeting_id=?',(baseline['id'],))}
416
+ # Replay each immutable weekly record onto a copy of its predecessor.
417
+ # This preserves CLOSED history even when a week was never downloaded.
418
+ periods=db().execute('SELECT id FROM meetings WHERE meeting_date>? AND meeting_date<=? ORDER BY meeting_date',(baseline['meeting_date'],data['meeting']['meeting_date'])).fetchall()
419
+ try:
420
+ for period in periods:
421
+ weekly=report_data(period['id']);weekly['owner_map']=aliases
422
+ previous=export_report(weekly,previous,style_workbook=style_workbook).getvalue()
423
+ except ValueError as error:
424
+ abort(409,str(error))
425
+ filename=f"MOM_Technical Report on {date.fromisoformat(data['meeting']['meeting_date']).strftime('%d-%m-%Y')}.xlsx"
426
+ reports_dir=Path(app.config['DATABASE']).parent/'reports';reports_dir.mkdir(exist_ok=True)
427
+ # Atomic replacement permits repeated downloads without duplicate CLOSED rows.
428
+ output_path=reports_dir/filename
429
+ temp_path=reports_dir/(secrets.token_hex(12)+'.tmp')
430
+ temp_path.write_bytes(previous);os.replace(temp_path,output_path)
431
+ return send_file(BytesIO(previous),as_attachment=True,download_name=filename,mimetype='application/vnd.openxmlformats-officedocument.spreadsheetml.sheet')
432
+
433
+ @app.get('/reports/<int:mid>/original')
434
+ def original(mid):
435
+ data=report_data(mid)
436
+ filename=data['meeting']['source_file']
437
+ if not filename:
438
+ abort(404)
439
+ if filename.startswith('upload:'):
440
+ name=filename.removeprefix('upload:')
441
+ if not re.fullmatch(r'[a-f0-9]{32}\.xlsx',name):
442
+ abort(404)
443
+ return send_file(Path(app.config['DATABASE']).parent/'imports'/name,as_attachment=True,download_name='Original MOM report.xlsx')
444
+ return send_file(ROOT/'sources'/Path(filename).name,as_attachment=True)
445
+
446
+ @app.route('/admin',methods=['GET','POST'])
447
+ @admin_only
448
+ def admin():
449
+ if request.method=='POST':
450
+ try:
451
+ op=request.form.get('operation')
452
+ if op=='meeting':
453
+ meeting_date=date_field('meeting_date')
454
+ latest=db().execute('SELECT MAX(meeting_date) FROM meetings').fetchone()[0]
455
+ if latest and meeting_date<=latest:
456
+ raise ValueError('The new meeting must be after the latest meeting date.')
457
+ if date.fromisoformat(meeting_date).weekday()!=0:
458
+ raise ValueError('Weekly meetings must be scheduled on a Monday.')
459
+ title=text_field('title',150)
460
+ location=text_field('location',150)
461
+ presenter=request.form.get('presenter','').strip()[:100]
462
+ minutes=request.form.get('minutes_by','').strip()[:100]
463
+ create_meeting(db(),meeting_date,title,location,presenter,minutes)
464
+ flash('New meeting opened. Unfinished actions have been carried forward.','success')
465
+ elif op=='rotation':
466
+ users=db().execute('SELECT id FROM users').fetchall()
467
+ values={}
468
+ for user in users:
469
+ value=request.form.get(f"order_{user['id']}",'').strip()
470
+ if value:
471
+ if not value.isdigit() or not 1<=int(value)<=100:
472
+ raise ValueError('Rotation positions must be numbers from 1 to 100, or blank to exclude a person.')
473
+ values[user['id']]=int(value)
474
+ if len(set(values.values()))!=len(values):
475
+ raise ValueError('Each rotation position must be unique.')
476
+ active_ids={u['id'] for u in db().execute('SELECT id FROM users WHERE active=1')}
477
+ if not active_ids.intersection(values):
478
+ raise ValueError('Keep at least one active member in the rotation.')
479
+ for user in users:
480
+ db().execute('UPDATE users SET rotation_order=? WHERE id=?',(values.get(user['id']),user['id']))
481
+ flash('Coordinator rotation saved. It will apply to future meetings.','success')
482
+ elif op=='assign':
483
+ target=db().execute('SELECT * FROM users WHERE id=? AND active=1',(request.form.get('coordinator_id'),)).fetchone()
484
+ if not target:
485
+ raise ValueError('Choose an active member.')
486
+ current=active_meeting()
487
+ db().execute('UPDATE meetings SET coordinator_id=?,minutes_by=? WHERE id=?',(target['id'],target['name'],current['id']))
488
+ flash('Current report coordinator updated.','success')
489
+ elif op in ('reset','toggle'):
490
+ user=db().execute('SELECT * FROM users WHERE id=?',(request.form.get('user_id'),)).fetchone()
491
+ if not user:
492
+ abort(404)
493
+ if user['id']==g.user['id']:
494
+ raise ValueError('Use Change password for your account. Your administrator account must remain active.')
495
+ if op=='reset':
496
+ db().execute('UPDATE users SET password_hash=?,must_change=1,session_version=session_version+1,failed_attempts=0,locked_until=0 WHERE id=?',(generate_password_hash(DEFAULT_PASSWORD),user['id']))
497
+ flash(f"Password reset for {user['name']}. They must change it at next login.",'success')
498
+ else:
499
+ db().execute('UPDATE users SET active=1-active,session_version=session_version+1 WHERE id=?',(user['id'],))
500
+ flash('Account access updated.','success')
501
+ else:
502
+ abort(400)
503
+ db().commit()
504
+ return redirect(url_for('admin'))
505
+ except (ValueError,sqlite3.IntegrityError) as error:
506
+ db().rollback()
507
+ flash(str(error) if isinstance(error,ValueError) else 'This meeting already exists.','error')
508
+ return render_template('admin.html',users=db().execute('SELECT * FROM users ORDER BY rotation_order IS NULL,rotation_order,name').fetchall(),meeting=active_meeting())
509
+
510
+ @app.route('/coordinator',methods=['GET','POST'])
511
+ def coordinator():
512
+ meeting=active_meeting()
513
+ if not g.user['is_admin'] and meeting['coordinator_id']!=g.user['id']:
514
+ abort(403)
515
+ if request.method=='POST':
516
+ if request.form.get('meeting_id')!=str(meeting['id']):
517
+ abort(409,'The meeting changed. Reload and try again.')
518
+ try:
519
+ if request.form.get('operation')=='preparation_date':
520
+ prepared_on=date_field('prepared_on')
521
+ allowed={day.isoformat() for day in preparation_days(meeting['meeting_date'])}
522
+ if prepared_on not in allowed:
523
+ raise ValueError('Choose a working day in this meeting’s Monday-to-Friday reporting week.')
524
+ db().execute('UPDATE meetings SET prepared_on=? WHERE id=?',(prepared_on,meeting['id']))
525
+ flash('Report preparation date saved.','success')
526
+ elif request.form.get('operation')=='details':
527
+ title=text_field('title',150)
528
+ location=text_field('location',150)
529
+ presenter=request.form.get('presenter','').strip()[:100]
530
+ db().execute('UPDATE meetings SET title=?,location=?,presenter=? WHERE id=?',(title,location,presenter,meeting['id']))
531
+ flash('Meeting details saved.','success')
532
+ elif request.form.get('operation')=='next':
533
+ following=(date.fromisoformat(meeting['meeting_date'])+timedelta(days=7)).isoformat()
534
+ create_meeting(db(),following,meeting['title'],meeting['location'])
535
+ flash('Next Monday’s meeting is open and the coordinator role has rotated.','success')
536
+ db().commit()
537
+ return redirect(url_for('dashboard'))
538
+ else:
539
+ abort(400)
540
+ db().commit()
541
+ return redirect(url_for('coordinator'))
542
+ except ValueError as error:
543
+ db().rollback()
544
+ flash(str(error),'error')
545
+ data=report_data(meeting['id'])
546
+ data['next_owner']=next_coordinator(db())
547
+ data['next_date']=(date.fromisoformat(meeting['meeting_date'])+timedelta(days=7)).isoformat()
548
+ data['preparation_days']=preparation_days(meeting['meeting_date'])
549
+ return render_template('coordinator.html',**data)
550
+
551
+ @app.get('/admin/backup')
552
+ @admin_only
553
+ def backup():
554
+ with tempfile.TemporaryDirectory() as directory:
555
+ path=Path(directory)/'mom.sqlite3'
556
+ target=sqlite3.connect(path)
557
+ try:
558
+ db().backup(target)
559
+ finally:
560
+ target.close()
561
+ content=BytesIO(path.read_bytes())
562
+ return send_file(content,as_attachment=True,download_name=f'mom-backup-{date.today().isoformat()}.sqlite3',mimetype='application/octet-stream')
563
+
564
+ @app.errorhandler(400)
565
+ @app.errorhandler(403)
566
+ @app.errorhandler(404)
567
+ @app.errorhandler(409)
568
+ @app.errorhandler(413)
569
+ def error_page(error):
570
+ return render_template('error.html',error=error),error.code
571
+
572
+ return app
573
+
574
+ if __name__=='__main__':
575
+ from waitress import serve
576
+ import argparse
577
+ parser=argparse.ArgumentParser(description='Run the local MOM application')
578
+ parser.add_argument('--host',default='127.0.0.1')
579
+ parser.add_argument('--port',type=int,default=5000)
580
+ args=parser.parse_args()
581
+ print(f'MOM is ready at http://{args.host}:{args.port}',flush=True)
582
+ serve(create_app(),host=args.host,port=args.port,threads=4)
exporter.py ADDED
@@ -0,0 +1,233 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Edit a copy of the previous XLSX, retaining its original workbook package."""
2
+ from datetime import date, timedelta
3
+ from io import BytesIO
4
+ from math import ceil
5
+ from pathlib import PurePosixPath
6
+ from zipfile import ZipFile, ZIP_DEFLATED
7
+ from xml.dom import minidom
8
+ import re
9
+
10
+ S='http://schemas.openxmlformats.org/spreadsheetml/2006/main'
11
+ R='http://schemas.openxmlformats.org/officeDocument/2006/relationships'
12
+
13
+ def children(node,name):
14
+ return [n for n in node.childNodes if n.nodeType==n.ELEMENT_NODE and n.localName==name]
15
+
16
+ def nodes(node,name):
17
+ return list(node.getElementsByTagNameNS(S,name))
18
+
19
+ def text(node):
20
+ return ''.join(n.data if n.nodeType in (n.TEXT_NODE,n.CDATA_SECTION_NODE) else text(n) for n in node.childNodes)
21
+
22
+ class Sheet:
23
+ def __init__(self,raw,strings):
24
+ self.doc=minidom.parseString(raw)
25
+ self.root=self.doc.documentElement
26
+ self.data=nodes(self.root,'sheetData')[0]
27
+ self.strings=strings
28
+ self.rows={int(r.getAttribute('r')):r for r in children(self.data,'row')}
29
+ self.row_map={}
30
+
31
+ def value(self,row,col):
32
+ for c in children(row,'c'):
33
+ if re.sub(r'\d+','',c.getAttribute('r'))!=col:continue
34
+ if c.getAttribute('t')=='inlineStr':return ''.join(text(n) for n in children(c,'is')).strip()
35
+ vals=children(c,'v')
36
+ if not vals:return ''
37
+ value=text(vals[0])
38
+ return self.strings[int(value)].strip() if c.getAttribute('t')=='s' else value
39
+ return ''
40
+
41
+ def set(self,row,col,value):
42
+ ref=col+row.getAttribute('r')
43
+ cell=next((c for c in children(row,'c') if c.getAttribute('r')==ref),None)
44
+ if cell is None:
45
+ cell=self.doc.createElementNS(S,'c');cell.setAttribute('r',ref);row.appendChild(cell)
46
+ for n in list(cell.childNodes):cell.removeChild(n)
47
+ if cell.hasAttribute('t'):cell.removeAttribute('t')
48
+ if value is None or value=='':return
49
+ if isinstance(value,(int,float)):
50
+ v=self.doc.createElementNS(S,'v');v.appendChild(self.doc.createTextNode(str(value)));cell.appendChild(v)
51
+ else:
52
+ cell.setAttribute('t','inlineStr')
53
+ inline=self.doc.createElementNS(S,'is');t=self.doc.createElementNS(S,'t')
54
+ t.setAttribute('xml:space','preserve');t.appendChild(self.doc.createTextNode(str(value)))
55
+ inline.appendChild(t);cell.appendChild(inline)
56
+
57
+ def clone(self,row,number,values=None):
58
+ clone=row.cloneNode(True);clone.setAttribute('r',str(number))
59
+ for cell in children(clone,'c'):
60
+ cell.setAttribute('r',re.sub(r'\d+',str(number),cell.getAttribute('r')))
61
+ if values is not None:
62
+ for col in 'ABCDE':self.set(clone,col,values.get(col))
63
+ lines=max((sum(max(1,ceil(len(line)/100)) for line in str(v).splitlines()) for v in values.values()),default=1)
64
+ clone.setAttribute('ht',str(min(409,max(float(row.getAttribute('ht') or 20),lines*15+8))))
65
+ clone.setAttribute('customHeight','1')
66
+ return clone
67
+
68
+ def replace(self,rows):
69
+ for row in list(self.data.childNodes):self.data.removeChild(row)
70
+ for row in rows:self.data.appendChild(row)
71
+
72
+ def mapped(self,old):
73
+ if old in self.row_map:return self.row_map[old]
74
+ earlier=[r for r in self.row_map if r<=old]
75
+ if not earlier:return old
76
+ anchor=max(earlier)
77
+ return self.row_map[anchor]+old-anchor
78
+
79
+ def shift_references(self):
80
+ def ref(value):
81
+ return re.sub(r'(\$?[A-Z]{1,3}\$?)(\d+)',lambda m:m[1]+str(self.mapped(int(m[2]))),value)
82
+ for name,attrs in [('mergeCell',['ref']),('conditionalFormatting',['sqref']),('dataValidation',['sqref']),('hyperlink',['ref']),('autoFilter',['ref']),('dimension',['ref'])]:
83
+ for node in nodes(self.root,name):
84
+ for attr in attrs:
85
+ if node.hasAttribute(attr):node.setAttribute(attr,ref(node.getAttribute(attr)))
86
+ for node in nodes(self.root,'sheetView'):node.setAttribute('topLeftCell','A1')
87
+ for node in nodes(self.root,'selection'):
88
+ node.setAttribute('activeCell','A1');node.setAttribute('sqref','A1')
89
+
90
+ def bytes(self):return self.doc.toxml(encoding='UTF-8')
91
+
92
+ def worksheet_paths(package):
93
+ doc=minidom.parseString(package['xl/workbook.xml'])
94
+ rels=minidom.parseString(package['xl/_rels/workbook.xml.rels'])
95
+ mapping={n.getAttribute('Id'):n.getAttribute('Target') for n in rels.documentElement.childNodes if n.nodeType==n.ELEMENT_NODE}
96
+ result=[]
97
+ for node in nodes(doc,'sheet'):
98
+ target=mapping[node.getAttributeNS(R,'id')]
99
+ path=target.lstrip('/') if target.startswith('/') else 'xl/'+target
100
+ if '..' in PurePosixPath(path).parts:raise ValueError('Unsupported worksheet path in the previous report.')
101
+ result.append((node.getAttribute('name'),path))
102
+ return result
103
+
104
+ def add_closed_sheet(package):
105
+ book=minidom.parseString(package['xl/workbook.xml'])
106
+ book.documentElement.setAttribute('xmlns:r',R)
107
+ rels=minidom.parseString(package['xl/_rels/workbook.xml.rels'])
108
+ types=minidom.parseString(package['[Content_Types].xml'])
109
+ number=max(int(n.getAttribute('sheetId')) for n in nodes(book,'sheet'))+1
110
+ path=f'xl/worksheets/sheet{number}.xml'
111
+ while path in package:number+=1;path=f'xl/worksheets/sheet{number}.xml'
112
+ relid='rIdMOMClosed'
113
+ ids={n.getAttribute('Id') for n in rels.documentElement.childNodes if n.nodeType==n.ELEMENT_NODE}
114
+ while relid in ids:relid+='X'
115
+ sheet=book.createElementNS(S,'sheet');sheet.setAttribute('name','CLOSED');sheet.setAttribute('sheetId',str(number));sheet.setAttributeNS(R,'r:id',relid)
116
+ nodes(book,'sheets')[0].appendChild(sheet)
117
+ relation=rels.createElementNS(rels.documentElement.namespaceURI,'Relationship')
118
+ for key,value in dict(Id=relid,Type=R+'/worksheet',Target=path[3:]).items():relation.setAttribute(key,value)
119
+ rels.documentElement.appendChild(relation)
120
+ override=types.createElementNS(types.documentElement.namespaceURI,'Override')
121
+ override.setAttribute('PartName','/'+path);override.setAttribute('ContentType','application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml')
122
+ types.documentElement.appendChild(override)
123
+ package['xl/workbook.xml']=book.toxml(encoding='UTF-8');package['xl/_rels/workbook.xml.rels']=rels.toxml(encoding='UTF-8');package['[Content_Types].xml']=types.toxml(encoding='UTF-8')
124
+ package[path]=f'<worksheet xmlns="{S}"><dimension ref="A1:E1"/><sheetData><row r="1"/></sheetData></worksheet>'.encode()
125
+ return path
126
+
127
+ def export_report(data,previous_workbook,style_workbook=None):
128
+ """Replace this week's entries, append completions, and retain all other parts."""
129
+ with ZipFile(BytesIO(previous_workbook)) as source:
130
+ infos=source.infolist();package={i.filename:source.read(i.filename) for i in infos}
131
+ paths=worksheet_paths(package)
132
+ mom_path=next((p for name,p in paths if name.casefold()=='mom'),paths[0][1])
133
+ closed_path=next((p for name,p in paths if name.casefold()=='closed'),None)
134
+ if not closed_path:closed_path=add_closed_sheet(package)
135
+ shared=minidom.parseString(package['xl/sharedStrings.xml']) if 'xl/sharedStrings.xml' in package else None
136
+ strings=[text(n) for n in nodes(shared,'si')] if shared else []
137
+ mom=Sheet(package[mom_path],strings);closed=Sheet(package[closed_path],strings)
138
+ ordered=sorted(mom.rows.items())
139
+ headers=[(i,re.sub(r'^\s*Updates from\s+','',mom.value(r,'A'),flags=re.I).strip()) for i,r in ordered if re.match(r'^\s*Updates from\s+',mom.value(r,'A'),re.I)]
140
+ action_header=next((i for i,r in ordered if mom.value(r,'B').casefold() in ('action','actions') and mom.value(r,'D').casefold()=='owner'),None)
141
+ if not headers or not action_header:raise ValueError('The previous workbook must have Updates from Name sections and Actions / Due Date / Owner columns.')
142
+ action_rows=[i for i,r in ordered if i>action_header and mom.value(r,'A').isdigit() and mom.value(r,'B')]
143
+ footer_start=max(action_rows,default=action_header)+1
144
+ update_sample=mom.rows.get(headers[0][0]+1,mom.rows[headers[0][0]])
145
+ # A previously empty section takes its row styling from a remaining update/action.
146
+ if not mom.value(update_sample,'A').isdigit():
147
+ update_sample=next((r for i,r in ordered if i<action_header and mom.value(r,'A').isdigit()),mom.rows.get(action_header+1,update_sample))
148
+ action_sample=mom.rows[action_rows[0]] if action_rows else update_sample
149
+ if style_workbook:
150
+ with ZipFile(BytesIO(style_workbook)) as styles_zip:
151
+ style_package={i.filename:styles_zip.read(i.filename) for i in styles_zip.infolist()}
152
+ style_paths=worksheet_paths(style_package)
153
+ style_path=next((p for name,p in style_paths if name.casefold()=='mom'),style_paths[0][1])
154
+ style_shared=minidom.parseString(style_package['xl/sharedStrings.xml']) if 'xl/sharedStrings.xml' in style_package else None
155
+ style_strings=[text(n) for n in nodes(style_shared,'si')] if style_shared else []
156
+ style_sheet=Sheet(style_package[style_path],style_strings)
157
+ style_action_header=next((i for i,r in style_sheet.rows.items() if style_sheet.value(r,'B').casefold() in ('action','actions') and style_sheet.value(r,'D').casefold()=='owner'),None)
158
+ if style_action_header:
159
+ update_sample=next((r for i,r in sorted(style_sheet.rows.items()) if i<style_action_header and style_sheet.value(r,'A').isdigit()),update_sample)
160
+ action_sample=next((r for i,r in sorted(style_sheet.rows.items()) if i>style_action_header and style_sheet.value(r,'A').isdigit()),action_sample)
161
+ users=[dict(u) for u in data['users']]
162
+ def find_owner(name):
163
+ from importer import suggest_owner
164
+ return data.get('owner_map',{}).get(name) or suggest_owner(name,users)
165
+ updates={u['id']:[] for u in users}
166
+ for item in data['updates']:updates.setdefault(item['user_id'],[]).append(item['body'])
167
+ output=[]
168
+ def keep(old):
169
+ new=len(output)+1;mom.row_map[old]=new;output.append(mom.clone(mom.rows[old],new))
170
+ # Retain genuine blank rows in the cover as well as rows with metadata.
171
+ for old in range(1,headers[0][0]):
172
+ if old in mom.rows:keep(old)
173
+ else:
174
+ row=mom.doc.createElementNS(S,'row');row.setAttribute('r',str(len(output)+1));output.append(row);mom.row_map[old]=len(output)
175
+ seen=set()
176
+ for index,(start,name) in enumerate(headers):
177
+ keep(start);uid=find_owner(name)
178
+ if uid is not None:seen.add(uid)
179
+ end=headers[index+1][0] if index+1<len(headers) else action_header
180
+ sample=next((mom.rows[i] for i in range(start+1,end) if i in mom.rows and mom.value(mom.rows[i],'A').isdigit()),update_sample)
181
+ bodies=updates.get(uid,[])
182
+ for serial,body in enumerate(bodies,1):output.append(mom.clone(sample,len(output)+1,{'A':serial,'B':body}))
183
+ for old in range(start+1,end):mom.row_map[old]=mom.row_map[start]+min(old-start,max(1,len(bodies)))
184
+ for user in users:
185
+ if user['id'] in seen or not updates[user['id']]:continue
186
+ output.append(mom.clone(mom.rows[headers[-1][0]],len(output)+1,{'A':'Updates from '+user['name']}))
187
+ for serial,body in enumerate(updates[user['id']],1):output.append(mom.clone(update_sample,len(output)+1,{'A':serial,'B':body}))
188
+ keep(action_header)
189
+ epoch=date(1904,1,1) if re.search(br'date1904="(?:1|true)"',package['xl/workbook.xml']) else date(1899,12,30)
190
+ def deadline(action):return action['due_note'] or ((date.fromisoformat(action['due_date'])-epoch).days if action['due_date'] else '')
191
+ # Prior unfinished items stay in database history, never in this week's Excel.
192
+ active=list(data['actions'])
193
+ for serial,action in enumerate(active,1):output.append(mom.clone(action_sample,len(output)+1,{'A':serial,'B':action['body'],'C':deadline(action),'D':action['name']}))
194
+ for offset,old in enumerate(action_rows,1):mom.row_map[old]=mom.row_map[action_header]+min(offset,max(1,len(active)))
195
+ for old,_ in ordered:
196
+ if old>=footer_start:keep(old)
197
+ meeting=data['meeting'];meeting_day=date.fromisoformat(meeting['meeting_date'])
198
+ fields={'meeting date':meeting_day.strftime('%A %d-%b-%Y'),'location':meeting['location'],'subject':meeting['title'],'minutes taken by':meeting['minutes_by']}
199
+ if meeting['presenter']:fields['presented by']=meeting['presenter']
200
+ for row in output:
201
+ label=mom.value(row,'A').strip().casefold()
202
+ if label in fields:mom.set(row,'C',fields[label])
203
+ if label.startswith('next weekly meeting'):mom.set(row,'A','Next weekly meeting on '+(meeting_day+timedelta(days=7)).strftime('%d-%m-%Y'))
204
+ mom.replace(output);mom.shift_references()
205
+ records=[(old,row) for old,row in sorted(closed.rows.items()) if old>1 and (closed.value(row,'B') or closed.value(row,'D') or closed.value(row,'E')) and closed.value(row,'B').casefold()!='actions']
206
+ if not closed.value(closed.rows[1],'B'):
207
+ for col,value in zip('ABCDE',['Sl No','Actions','Due Date','Owner','Status']):closed.set(closed.rows[1],col,value)
208
+ for serial,(_,row) in enumerate(records,1):
209
+ if closed.value(row,'A')!=str(serial):closed.set(row,'A',serial)
210
+ last=records[-1][0] if records else 1
211
+ sample=records[-1][1] if records else closed.doc.importNode(action_sample,True)
212
+ completed=[a for a in data['reviews'] if a['checked']]
213
+ added=[closed.clone(sample,last+i,{'A':len(records)+i,'B':a['body'],'C':deadline(a),'D':a['name'],'E':'Completed'}) for i,a in enumerate(completed,1)]
214
+ tail=[]
215
+ for old,row in sorted(closed.rows.items()):
216
+ if old>last:tail.append(closed.clone(row,old+len(added)))
217
+ closed.row_map[old]=old+(len(added) if old>last else 0)
218
+ closed.replace([row for old,row in sorted(closed.rows.items()) if old<=last]+added+tail);closed.shift_references()
219
+ dimension=nodes(closed.root,'dimension')
220
+ if dimension:
221
+ current=dimension[0].getAttribute('ref')
222
+ max_row=max(int(r.getAttribute('r')) for r in children(closed.data,'row'))
223
+ match=re.search(r'([A-Z]+)(\d+)$',current)
224
+ if match and int(match[2])<max_row:
225
+ dimension[0].setAttribute('ref',current[:match.start()]+match[1]+str(max_row))
226
+ package[mom_path]=mom.bytes();package[closed_path]=closed.bytes()
227
+ result=BytesIO()
228
+ with ZipFile(result,'w',ZIP_DEFLATED) as target:
229
+ original_names={i.filename for i in infos}
230
+ for info in infos:target.writestr(info,package[info.filename])
231
+ for name in package.keys()-original_names:target.writestr(name,package[name])
232
+ result.seek(0)
233
+ return result
importer.py ADDED
@@ -0,0 +1,101 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Bounded, data-only parser for the team's Excel MOM layout and app exports."""
2
+ from datetime import datetime, timedelta
3
+ from io import BytesIO
4
+ from pathlib import PurePosixPath
5
+ from zipfile import ZipFile, BadZipFile
6
+ import re
7
+ import xml.etree.ElementTree as ET
8
+
9
+ NS={'s':'http://schemas.openxmlformats.org/spreadsheetml/2006/main'}
10
+
11
+ def parse_report(content):
12
+ def xml(data):
13
+ if b'<!DOCTYPE' in data.upper() or b'<!ENTITY' in data.upper():
14
+ raise ValueError('This workbook contains unsupported XML declarations.')
15
+ return ET.fromstring(data)
16
+ try:
17
+ with ZipFile(BytesIO(content)) as z:
18
+ if sum(i.file_size for i in z.infolist())>80*1024*1024:
19
+ raise ValueError('The uncompressed workbook is too large (80 MB maximum).')
20
+ strings=[]
21
+ if 'xl/sharedStrings.xml' in z.namelist():
22
+ strings=[''.join(n.itertext()) for n in xml(z.read('xl/sharedStrings.xml')).findall('s:si',NS)]
23
+ book=xml(z.read('xl/workbook.xml'))
24
+ sheet=book.find('s:sheets/s:sheet',NS)
25
+ rel_id=sheet.attrib['{http://schemas.openxmlformats.org/officeDocument/2006/relationships}id']
26
+ rels=xml(z.read('xl/_rels/workbook.xml.rels'))
27
+ target=next(r.attrib['Target'] for r in rels if r.attrib['Id']==rel_id)
28
+ target=target.lstrip('/') if target.startswith('/') else 'xl/'+target
29
+ if '..' in PurePosixPath(target).parts:
30
+ raise ValueError('Unsupported worksheet path.')
31
+ rows={}
32
+ for c in xml(z.read(target)).findall('.//s:sheetData/s:row/s:c',NS):
33
+ ref=c.attrib['r']
34
+ match=re.fullmatch(r'([A-Z]+)(\d+)',ref)
35
+ col,row=match[1],int(match[2])
36
+ if row>20000 or col not in ('A','B','C','D','E'):
37
+ continue
38
+ value=c.find('s:v',NS)
39
+ if c.attrib.get('t')=='inlineStr':
40
+ node=c.find('s:is',NS)
41
+ text=''.join(node.itertext()) if node is not None else ''
42
+ elif value is not None and value.text:
43
+ text=strings[int(value.text)] if c.attrib.get('t')=='s' else value.text
44
+ else:
45
+ text=''
46
+ if text.strip():
47
+ rows.setdefault(row,{})[col]=text.strip()
48
+ except (BadZipFile,ET.ParseError,KeyError,IndexError,StopIteration,AttributeError,RuntimeError) as error:
49
+ raise ValueError('Unable to read this .xlsx workbook. Use the MOM layout with Actions, Due Date and Owner columns.') from error
50
+ epoch=datetime(1904,1,1) if (book.find('s:workbookPr',NS) is not None and book.find('s:workbookPr',NS).attrib.get('date1904') in ('1','true')) else datetime(1899,12,30)
51
+ result=dict(title='Weekly Technical Meeting',location='Opticent, Bangalore',presenter='',updates=[],actions=[],owners=[])
52
+ current=None
53
+ in_actions=False
54
+ found_action_table=False
55
+ for number,row in sorted(rows.items()):
56
+ a,b,c,d,e=[row.get(col,'') for col in 'ABCDE']
57
+ if a.lower() in ('subject','location','presented by'):
58
+ key={'subject':'title','location':'location','presented by':'presenter'}[a.lower()]
59
+ result[key]=c or b or result[key]
60
+ match=re.match(r'Updates from\s+(.+)',a,re.I)
61
+ if match:
62
+ current=re.sub(r'\s*\((Imported|Submitted|Draft|No entry)\)\s*$','',match[1],flags=re.I).strip()
63
+ in_actions=False
64
+ elif b.lower() in ('actions','action') and d.lower()=='owner':
65
+ in_actions=True
66
+ found_action_table=True
67
+ current=None
68
+ elif a.lower() in ('previous action review','actions from this meeting'):
69
+ in_actions=True
70
+ current=None
71
+ elif in_actions and b and d and a.isdigit():
72
+ due=None
73
+ if re.fullmatch(r'\d+(\.\d+)?',c):
74
+ try:
75
+ due=(epoch+timedelta(days=float(c))).date().isoformat()
76
+ except (OverflowError,ValueError):
77
+ raise ValueError(f'Invalid date in row {number}.') from None
78
+ else:
79
+ for fmt in ('%Y-%m-%d','%d-%m-%Y','%d/%m/%Y','%d-%b-%Y'):
80
+ try:
81
+ due=datetime.strptime(c,fmt).date().isoformat()
82
+ break
83
+ except ValueError:
84
+ pass
85
+ result['actions'].append(dict(owner=d,body=b,due_date=due,due_note='' if due else c,completed=e.lower() in ('completed','complete','done'),row=number))
86
+ elif current and a.isdigit() and b and b!='No updates recorded.':
87
+ result['updates'].append(dict(owner=current,body=b,row=number))
88
+ if not found_action_table:
89
+ raise ValueError('No action table was found. The first worksheet must contain Actions, Due Date and Owner columns (B, C and D).')
90
+ result['owners']=sorted({x['owner'] for x in result['updates']+result['actions']},key=str.casefold)
91
+ if len(result['owners'])>100 or len(result['actions'])>2000 or len(result['updates'])>5000:
92
+ raise ValueError('This workbook exceeds the supported MOM report size.')
93
+ return result
94
+
95
+ def suggest_owner(name,users):
96
+ normal=lambda s:re.sub('[^a-z0-9]','',s.lower())
97
+ exact=[u for u in users if normal(u['name'])==normal(name)]
98
+ if len(exact)==1:
99
+ return exact[0]['id']
100
+ first=[u for u in users if u['name'].split()[0].lower()==name.split()[0].lower()]
101
+ return first[0]['id'] if len(first)==1 else None
launcher.py ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Windows double-click entry point with browser opening and persistent server."""
2
+ import threading
3
+ import urllib.request
4
+ import webbrowser
5
+ from app import create_app
6
+ from waitress import serve
7
+
8
+ URL='http://127.0.0.1:5000'
9
+
10
+ def open_when_ready():
11
+ import time
12
+ for _ in range(50):
13
+ try:
14
+ with urllib.request.urlopen(URL+'/login',timeout=1) as response:
15
+ if response.status==200:
16
+ webbrowser.open(URL)
17
+ return
18
+ except OSError:
19
+ time.sleep(.2)
20
+
21
+ if __name__=='__main__':
22
+ try:
23
+ with urllib.request.urlopen(URL+'/login',timeout=1) as response:
24
+ existing=response.read().decode('utf-8')
25
+ if 'Sign in · MOM' in existing:
26
+ webbrowser.open(URL)
27
+ print('The MOM app is already running. Opened it in your browser.')
28
+ raise SystemExit(0)
29
+ except OSError:
30
+ pass
31
+ app=create_app()
32
+ print('MOM is running at '+URL+'\nKeep this window open while using the app. Press Ctrl+C to stop.',flush=True)
33
+ threading.Thread(target=open_when_ready,daemon=True).start()
34
+ try:
35
+ serve(app,host='127.0.0.1',port=5000,threads=4)
36
+ except OSError as error:
37
+ print('Could not start the app. Port 5000 may be in use: '+str(error))
38
+ raise SystemExit(1)
package_project.py ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Create a portable source archive, excluding passwords, databases and test data."""
2
+ from pathlib import Path
3
+ from zipfile import ZipFile, ZIP_DEFLATED
4
+
5
+ root=Path(__file__).resolve().parent
6
+ files=['app.py','schema.sql','seed.py','seed_data.json','importer.py','setup_routes.py','exporter.py',
7
+ 'launcher.py','setup.bat','start_mom.bat','requirements.txt','requirements-dev.txt',
8
+ 'README.md','PLAN.md','.gitignore','prepare_sources.py']
9
+ for directory in ['templates','static','sources','tests']:
10
+ files.extend(str(p.relative_to(root)) for p in (root/directory).rglob('*') if p.is_file() and '__pycache__' not in p.parts)
11
+ with ZipFile(root/'MOM_App.zip','w',ZIP_DEFLATED) as archive:
12
+ for name in files:
13
+ archive.write(root/name,'MOM_App/'+name.replace('\\','/'))
14
+ print('Created MOM_App.zip with source code, original reports and launch instructions. No live data or credentials included.')
prepare_sources.py ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """One-time developer utility for the two supplied Excel sources (read only)."""
2
+ from datetime import datetime, timedelta
3
+ from pathlib import Path
4
+ from zipfile import ZipFile
5
+ import xml.etree.ElementTree as ET
6
+ import json
7
+ import re
8
+ import shutil
9
+
10
+ ROOT=Path(__file__).resolve().parent
11
+ NS={'s':'http://schemas.openxmlformats.org/spreadsheetml/2006/main'}
12
+ names=['Kishan H M','Harshitha P','Gokul M','Manish J','Madhan D','Honey S P','Madhav S',
13
+ 'Shravan','Kamlakant','Vinay','Sunny','Rikki','Niranjan','Pavan Sai']
14
+ aliases={name.split()[0].lower():name for name in names}
15
+ def owner(value):
16
+ return aliases[value.strip().split()[0].lower()]
17
+
18
+ def prepare(source_directory):
19
+ reports=[]
20
+ (ROOT/'sources').mkdir(exist_ok=True)
21
+ for path in Path(source_directory).glob('MOM_Technical Report on *.xlsx'):
22
+ with ZipFile(path) as z:
23
+ strings=[''.join(n.itertext()) for n in ET.fromstring(z.read('xl/sharedStrings.xml')).findall('s:si',NS)]
24
+ cells={}
25
+ for cell in ET.fromstring(z.read('xl/worksheets/sheet1.xml')).findall('.//s:sheetData/s:row/s:c',NS):
26
+ v=cell.find('s:v',NS)
27
+ if v is not None and v.text:
28
+ cells[cell.attrib['r']]=strings[int(v.text)] if cell.attrib.get('t')=='s' else v.text
29
+ meeting_date=datetime.strptime(re.search(r'(\d{2}-\d{2}-\d{4})',path.name)[1],'%d-%m-%Y').date().isoformat()
30
+ # User clarified that the newer file was reused for Monday 21 September.
31
+ if path.name=='MOM_Technical Report on 15-09-2026.xlsx':
32
+ meeting_date='2026-09-21'
33
+ report=dict(file=path.name,date=meeting_date,title=cells.get('C9','Weekly Technical Meeting'),
34
+ location=cells.get('C5',''),presenter=cells.get('C6',''),minutes_by=cells.get('C10',''),
35
+ participants=cells.get('C7',''),updates=[],actions=[])
36
+ current=None
37
+ action_section=False
38
+ for row in range(12,max(int(re.search(r'\d+',key)[0]) for key in cells)+1):
39
+ a,b,c,d=[cells.get(f'{col}{row}','').strip() for col in 'ABCD']
40
+ match=re.match(r'Updates from\s+(.+)',a,re.I)
41
+ if match:
42
+ current=owner(match[1])
43
+ action_section=False
44
+ elif b.lower()=='actions':
45
+ action_section=True
46
+ current=None
47
+ elif action_section and b and d and a.isdigit():
48
+ due=(datetime(1899,12,30)+timedelta(days=float(c))).date().isoformat() if re.fullmatch(r'\d+(\.\d+)?',c) else None
49
+ report['actions'].append(dict(owner=owner(d),body=b,due_date=due,due_note='' if due else c))
50
+ elif current and b and a.isdigit():
51
+ report['updates'].append(dict(owner=current,body=b))
52
+ reports.append(report)
53
+ shutil.copy2(path,ROOT/'sources'/path.name)
54
+ reports.sort(key=lambda r:r['date'])
55
+ data=dict(users=[dict(name=n,username=n.split()[0].lower()) for n in names],reports=reports)
56
+ (ROOT/'seed_data.json').write_text(json.dumps(data,ensure_ascii=False,indent=2),encoding='utf-8')
57
+ print(json.dumps({'users':len(names),'reports':[{k:r[k] for k in ['file','date','participants']} | {'updates':len(r['updates']),'actions':len(r['actions'])} for r in reports]},indent=2))
58
+
59
+ if __name__=='__main__':
60
+ import sys
61
+ prepare(sys.argv[1] if len(sys.argv)>1 else ROOT.parent)
requirements-dev.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ -r requirements.txt
2
+ pytest==9.1.1
requirements.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ Flask==3.1.3
2
+ openpyxl==3.1.5
3
+ waitress==3.0.2
schema.sql ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ PRAGMA foreign_keys = ON;
2
+ CREATE TABLE IF NOT EXISTS users (
3
+ id INTEGER PRIMARY KEY, name TEXT NOT NULL, username TEXT NOT NULL UNIQUE COLLATE NOCASE,
4
+ password_hash TEXT NOT NULL, must_change INTEGER NOT NULL DEFAULT 1,
5
+ is_admin INTEGER NOT NULL DEFAULT 0, active INTEGER NOT NULL DEFAULT 1,
6
+ session_version INTEGER NOT NULL DEFAULT 1, failed_attempts INTEGER NOT NULL DEFAULT 0,
7
+ locked_until REAL NOT NULL DEFAULT 0, rotation_order INTEGER
8
+ );
9
+ CREATE TABLE IF NOT EXISTS meetings (
10
+ id INTEGER PRIMARY KEY, meeting_date TEXT NOT NULL UNIQUE, title TEXT NOT NULL,
11
+ location TEXT NOT NULL, presenter TEXT NOT NULL DEFAULT '', minutes_by TEXT NOT NULL DEFAULT '',
12
+ status TEXT NOT NULL CHECK(status IN ('active','closed')), source_file TEXT,
13
+ coordinator_id INTEGER REFERENCES users(id), prepared_on TEXT,
14
+ created_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP
15
+ );
16
+ CREATE UNIQUE INDEX IF NOT EXISTS one_active_meeting ON meetings(status) WHERE status='active';
17
+ CREATE TABLE IF NOT EXISTS updates (
18
+ id INTEGER PRIMARY KEY, meeting_id INTEGER NOT NULL REFERENCES meetings(id),
19
+ user_id INTEGER NOT NULL REFERENCES users(id), body TEXT NOT NULL,
20
+ entry_token TEXT UNIQUE, created_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP
21
+ );
22
+ CREATE TABLE IF NOT EXISTS actions (
23
+ id INTEGER PRIMARY KEY, meeting_id INTEGER NOT NULL REFERENCES meetings(id),
24
+ user_id INTEGER NOT NULL REFERENCES users(id), body TEXT NOT NULL, due_date TEXT,
25
+ due_note TEXT NOT NULL DEFAULT '', completed INTEGER NOT NULL DEFAULT 0,
26
+ archived INTEGER NOT NULL DEFAULT 0, entry_token TEXT UNIQUE,
27
+ created_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP
28
+ );
29
+ CREATE TABLE IF NOT EXISTS reviews (
30
+ meeting_id INTEGER NOT NULL REFERENCES meetings(id), action_id INTEGER NOT NULL REFERENCES actions(id),
31
+ completed INTEGER NOT NULL DEFAULT 0, PRIMARY KEY(meeting_id,action_id)
32
+ );
33
+ CREATE TABLE IF NOT EXISTS submissions (
34
+ meeting_id INTEGER NOT NULL REFERENCES meetings(id), user_id INTEGER NOT NULL REFERENCES users(id),
35
+ reviewed INTEGER NOT NULL DEFAULT 0, submitted_at TEXT,
36
+ PRIMARY KEY(meeting_id,user_id)
37
+ );
38
+ CREATE TABLE IF NOT EXISTS metadata (key TEXT PRIMARY KEY, value TEXT NOT NULL);
39
+ CREATE TABLE IF NOT EXISTS report_owner_aliases (
40
+ meeting_id INTEGER NOT NULL REFERENCES meetings(id), source_name TEXT NOT NULL,
41
+ user_id INTEGER NOT NULL REFERENCES users(id), PRIMARY KEY(meeting_id,source_name)
42
+ );
43
+ CREATE INDEX IF NOT EXISTS updates_owner ON updates(meeting_id,user_id);
44
+ CREATE INDEX IF NOT EXISTS actions_owner ON actions(meeting_id,user_id);
seed.py ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Import the reviewed, local source snapshot once; never overwrite live data."""
2
+ import json
3
+ from datetime import date
4
+ from pathlib import Path
5
+ from werkzeug.security import generate_password_hash
6
+
7
+ DEFAULT_PASSWORD = 'Password@123'
8
+
9
+ def next_coordinator(db):
10
+ roster=db.execute('SELECT * FROM users WHERE active=1 AND rotation_order IS NOT NULL ORDER BY rotation_order,id').fetchall()
11
+ if not roster:
12
+ raise ValueError('Add at least one active member to the coordinator rotation.')
13
+ current=db.execute('SELECT coordinator_id FROM meetings ORDER BY meeting_date DESC LIMIT 1').fetchone()
14
+ ids=[u['id'] for u in roster]
15
+ index=(ids.index(current['coordinator_id'])+1)%len(ids) if current and current['coordinator_id'] in ids else 0
16
+ return roster[index]
17
+
18
+ def create_meeting(db, meeting_date, title, location, presenter='', minutes_by='', coordinator_id=None):
19
+ if coordinator_id is None:
20
+ coordinator_id=next_coordinator(db)['id']
21
+ coordinator=db.execute('SELECT name FROM users WHERE id=?',(coordinator_id,)).fetchone()
22
+ minutes_by=minutes_by or coordinator['name']
23
+ db.execute("UPDATE meetings SET status='closed' WHERE status='active'")
24
+ meeting_id = db.execute(
25
+ 'INSERT INTO meetings(meeting_date,title,location,presenter,minutes_by,status,coordinator_id) VALUES(?,?,?,?,?,?,?)',
26
+ (meeting_date, title, location, presenter, minutes_by, 'active',coordinator_id)).lastrowid
27
+ db.execute('INSERT INTO reviews(meeting_id,action_id) SELECT ?,id FROM actions WHERE completed=0 AND archived=0', (meeting_id,))
28
+ return meeting_id
29
+
30
+ def seed_database(db, source_path):
31
+ if db.execute("SELECT 1 FROM metadata WHERE key='seeded'").fetchone():
32
+ return
33
+ source = json.loads(Path(source_path).read_text(encoding='utf-8'))
34
+ ids = {}
35
+ for order,user in enumerate(source['users'],1):
36
+ ids[user['name']] = db.execute(
37
+ 'INSERT INTO users(name,username,password_hash,is_admin,rotation_order) VALUES(?,?,?,?,?)',
38
+ (user['name'], user['username'], generate_password_hash(DEFAULT_PASSWORD), user['username']=='kishan',order if order<=7 else None)).lastrowid
39
+ for index, report in enumerate(source['reports']):
40
+ mid = db.execute('INSERT INTO meetings(meeting_date,title,location,presenter,minutes_by,status,source_file,coordinator_id) VALUES(?,?,?,?,?,?,?,?)',
41
+ (report['date'],report['title'],report['location'],report['presenter'],'Kishan H M','closed',report['file'],ids['Kishan H M'])).lastrowid
42
+ contributors = set()
43
+ for update in report['updates']:
44
+ uid = ids[update['owner']]
45
+ contributors.add(uid)
46
+ db.execute('INSERT INTO updates(meeting_id,user_id,body) VALUES(?,?,?)',(mid,uid,update['body']))
47
+ for action in report['actions']:
48
+ uid = ids[action['owner']]
49
+ contributors.add(uid)
50
+ db.execute('INSERT INTO actions(meeting_id,user_id,body,due_date,due_note,archived) VALUES(?,?,?,?,?,?)',
51
+ (mid,uid,action['body'],action['due_date'],action['due_note'],index != len(source['reports'])-1))
52
+ for uid in contributors:
53
+ db.execute('INSERT INTO submissions(meeting_id,user_id,reviewed,submitted_at) VALUES(?,?,1,?)',(mid,uid,report['date']+' 00:00:00'))
54
+ latest = source['reports'][-1]
55
+ from datetime import timedelta
56
+ earliest=max(date.today(),date.fromisoformat(latest['date'])+timedelta(days=7))
57
+ first_date = (earliest+timedelta(days=(-earliest.weekday())%7)).isoformat()
58
+ create_meeting(db, first_date, latest['title'], latest['location'])
59
+ db.execute("INSERT INTO metadata(key,value) VALUES('seeded','1')")
60
+ db.commit()
61
+
62
+ def migrate_weekly(db):
63
+ """One-time migration for the initial local preview, preserving entered data."""
64
+ if 'prepared_on' not in [r['name'] for r in db.execute('PRAGMA table_info(meetings)')]:
65
+ db.execute('ALTER TABLE meetings ADD COLUMN prepared_on TEXT')
66
+ db.commit()
67
+ if 'rotation_order' not in [r['name'] for r in db.execute('PRAGMA table_info(users)')]:
68
+ db.execute('ALTER TABLE users ADD COLUMN rotation_order INTEGER')
69
+ db.execute('UPDATE users SET rotation_order=id')
70
+ if 'coordinator_id' not in [r['name'] for r in db.execute('PRAGMA table_info(meetings)')]:
71
+ db.execute('ALTER TABLE meetings ADD COLUMN coordinator_id INTEGER REFERENCES users(id)')
72
+ if db.execute('SELECT 1 FROM users LIMIT 1').fetchone() and not db.execute("SELECT 1 FROM metadata WHERE key='seven_member_rotation'").fetchone():
73
+ rotation=['kishan','harshitha','gokul','manish','madhan','honey','madhav']
74
+ db.execute('UPDATE users SET rotation_order=NULL')
75
+ for position,username in enumerate(rotation,1):
76
+ db.execute('UPDATE users SET rotation_order=? WHERE username=?',(position,username))
77
+ db.execute("INSERT INTO metadata(key,value) VALUES('seven_member_rotation','1')")
78
+ db.commit()
79
+ if db.execute("SELECT 1 FROM metadata WHERE key='weekly_rotation_v1'").fetchone():
80
+ return
81
+ kishan=db.execute("SELECT id FROM users WHERE username='kishan'").fetchone()
82
+ if kishan:
83
+ db.execute("UPDATE meetings SET coordinator_id=?,minutes_by='Kishan H M' WHERE source_file IS NOT NULL",(kishan['id'],))
84
+ db.execute("UPDATE meetings SET meeting_date='2026-09-21' WHERE source_file='MOM_Technical Report on 15-09-2026.xlsx'")
85
+ current=db.execute("SELECT * FROM meetings WHERE status='active'").fetchone()
86
+ if current and not current['coordinator_id']:
87
+ following=db.execute("SELECT id,name FROM users WHERE username='harshitha'").fetchone()
88
+ db.execute('UPDATE meetings SET coordinator_id=?,minutes_by=? WHERE id=?',(following['id'],following['name'],current['id']))
89
+ count=db.execute('SELECT (SELECT COUNT(*) FROM updates WHERE meeting_id=?)+(SELECT COUNT(*) FROM actions WHERE meeting_id=?)',(current['id'],current['id'])).fetchone()[0]
90
+ if not count and current['meeting_date']=='2026-09-23':
91
+ db.execute("UPDATE meetings SET meeting_date='2026-09-28' WHERE id=?",(current['id'],))
92
+ db.execute("INSERT INTO metadata(key,value) VALUES('weekly_rotation_v1','1')")
93
+ db.commit()
seed_data.json ADDED
@@ -0,0 +1,1266 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "users": [
3
+ {
4
+ "name": "Kishan H M",
5
+ "username": "kishan"
6
+ },
7
+ {
8
+ "name": "Harshitha P",
9
+ "username": "harshitha"
10
+ },
11
+ {
12
+ "name": "Gokul M",
13
+ "username": "gokul"
14
+ },
15
+ {
16
+ "name": "Manish J",
17
+ "username": "manish"
18
+ },
19
+ {
20
+ "name": "Madhan D",
21
+ "username": "madhan"
22
+ },
23
+ {
24
+ "name": "Honey S P",
25
+ "username": "honey"
26
+ },
27
+ {
28
+ "name": "Madhav S",
29
+ "username": "madhav"
30
+ },
31
+ {
32
+ "name": "Shravan",
33
+ "username": "shravan"
34
+ },
35
+ {
36
+ "name": "Kamlakant",
37
+ "username": "kamlakant"
38
+ },
39
+ {
40
+ "name": "Vinay",
41
+ "username": "vinay"
42
+ },
43
+ {
44
+ "name": "Sunny",
45
+ "username": "sunny"
46
+ },
47
+ {
48
+ "name": "Rikki",
49
+ "username": "rikki"
50
+ },
51
+ {
52
+ "name": "Niranjan",
53
+ "username": "niranjan"
54
+ },
55
+ {
56
+ "name": "Pavan Sai",
57
+ "username": "pavan"
58
+ }
59
+ ],
60
+ "reports": [
61
+ {
62
+ "file": "MOM_Technical Report on 17-08-2026.xlsx",
63
+ "date": "2026-08-17",
64
+ "title": "Weekly Technical Meeting",
65
+ "location": "Opticent, Bangalore",
66
+ "presenter": "Niranjan",
67
+ "minutes_by": "Kishan H M",
68
+ "participants": "Shravan, Kamlakant, Vinay, Gokul, Sunny, Rikki, Manish, Madhan, Harshitha,Pavan Sai,Kishan ",
69
+ "updates": [
70
+ {
71
+ "owner": "Madhav S",
72
+ "body": "Attended daily calls"
73
+ },
74
+ {
75
+ "owner": "Madhav S",
76
+ "body": "Attended project status calls"
77
+ },
78
+ {
79
+ "owner": "Madhav S",
80
+ "body": "Worked on CRS interactions download"
81
+ },
82
+ {
83
+ "owner": "Madhav S",
84
+ "body": "Worked on CRS recording download"
85
+ },
86
+ {
87
+ "owner": "Madhav S",
88
+ "body": "Worked on attendance website"
89
+ },
90
+ {
91
+ "owner": "Madhav S",
92
+ "body": "Workedon SEO for optima website"
93
+ },
94
+ {
95
+ "owner": "Madhav S",
96
+ "body": "Worked on agent desktop API integration"
97
+ },
98
+ {
99
+ "owner": "Madhav S",
100
+ "body": "Worked on agent desktop branches"
101
+ },
102
+ {
103
+ "owner": "Harshitha P",
104
+ "body": "Attended daily calls"
105
+ },
106
+ {
107
+ "owner": "Harshitha P",
108
+ "body": "Attended daily project status calls"
109
+ },
110
+ {
111
+ "owner": "Harshitha P",
112
+ "body": "Worked on preference API integration"
113
+ },
114
+ {
115
+ "owner": "Harshitha P",
116
+ "body": "Worked on UI development for preferences"
117
+ },
118
+ {
119
+ "owner": "Harshitha P",
120
+ "body": "Worked on testing preferences APIs in postman"
121
+ },
122
+ {
123
+ "owner": "Harshitha P",
124
+ "body": "Worked on modifying backend APIs"
125
+ },
126
+ {
127
+ "owner": "Harshitha P",
128
+ "body": "Worked on bug fixin in API integration"
129
+ },
130
+ {
131
+ "owner": "Manish J",
132
+ "body": "Attended daily calls"
133
+ },
134
+ {
135
+ "owner": "Manish J",
136
+ "body": "Worked on agent transcription genesys for crs"
137
+ },
138
+ {
139
+ "owner": "Manish J",
140
+ "body": "Worked on identifying the target keyword for product"
141
+ },
142
+ {
143
+ "owner": "Manish J",
144
+ "body": "Worked on SEO for interactive smart display LG and Samsung"
145
+ },
146
+ {
147
+ "owner": "Manish J",
148
+ "body": "Worked on changing the prices for the products"
149
+ },
150
+ {
151
+ "owner": "Manish J",
152
+ "body": "Workedon testing the APIs for roles and permissions in Agent desktop"
153
+ },
154
+ {
155
+ "owner": "Manish J",
156
+ "body": "Worked on UI for roles and permissions"
157
+ },
158
+ {
159
+ "owner": "Manish J",
160
+ "body": "Worked on modification for permissions UI"
161
+ },
162
+ {
163
+ "owner": "Vinay",
164
+ "body": "Attended weekly meeting on coforge"
165
+ },
166
+ {
167
+ "owner": "Vinay",
168
+ "body": "Attended internal call with team on coforge"
169
+ },
170
+ {
171
+ "owner": "Vinay",
172
+ "body": "Worked on trunk recording modification on Coforge"
173
+ },
174
+ {
175
+ "owner": "Vinay",
176
+ "body": "Worked on security training"
177
+ },
178
+ {
179
+ "owner": "Vinay",
180
+ "body": "Worked on weekly Graylog activity export"
181
+ },
182
+ {
183
+ "owner": "Vinay",
184
+ "body": "Attended knowledge base meeting on rescue team members addition for Coforge"
185
+ },
186
+ {
187
+ "owner": "Vinay",
188
+ "body": "Worked on API integration with IVR call flow for NTT"
189
+ },
190
+ {
191
+ "owner": "Vinay",
192
+ "body": "Worked on data action configuration on NTT"
193
+ },
194
+ {
195
+ "owner": "Gokul M",
196
+ "body": "Attended daily call"
197
+ },
198
+ {
199
+ "owner": "Gokul M",
200
+ "body": "Attended project status call"
201
+ },
202
+ {
203
+ "owner": "Gokul M",
204
+ "body": "Worked on translate API modification for CRS"
205
+ },
206
+ {
207
+ "owner": "Gokul M",
208
+ "body": "Worked on increasing speaker identification accuracy for CRS"
209
+ },
210
+ {
211
+ "owner": "Gokul M",
212
+ "body": "Worked on audio WAV file display in UI for CRS"
213
+ },
214
+ {
215
+ "owner": "Gokul M",
216
+ "body": "Worked on positive-negative sentiment indication in audio WAV file for CRS"
217
+ },
218
+ {
219
+ "owner": "Gokul M",
220
+ "body": "Worked on get all interaction page for CRS"
221
+ },
222
+ {
223
+ "owner": "Gokul M",
224
+ "body": "Worked on detail API, timeline API and transcrip API modification to getting datas from DB for CRS"
225
+ },
226
+ {
227
+ "owner": "Gokul M",
228
+ "body": "Worked on display transcription in UI for CRS"
229
+ },
230
+ {
231
+ "owner": "Gokul M",
232
+ "body": "Worked on client management API and UI integration for agent desktop"
233
+ },
234
+ {
235
+ "owner": "Kishan H M",
236
+ "body": "Worked on Correcting the folder structure for Module Management"
237
+ },
238
+ {
239
+ "owner": "Kishan H M",
240
+ "body": "Worked on API integration for subscription UI"
241
+ },
242
+ {
243
+ "owner": "Kishan H M",
244
+ "body": "Worked on creating UI for Super admin backend"
245
+ },
246
+ {
247
+ "owner": "Kishan H M",
248
+ "body": "Worked on integrating dashboard, Client, Roles APIs to the frontend"
249
+ },
250
+ {
251
+ "owner": "Kishan H M",
252
+ "body": "Worked on learning Genesys Cloud Communicate-70%"
253
+ },
254
+ {
255
+ "owner": "Kamlakant",
256
+ "body": "Attended daily call"
257
+ },
258
+ {
259
+ "owner": "Kamlakant",
260
+ "body": "Attended PHI all calls"
261
+ },
262
+ {
263
+ "owner": "Kamlakant",
264
+ "body": "Attended PHI troubleshooting calls"
265
+ },
266
+ {
267
+ "owner": "Kamlakant",
268
+ "body": "Attended call with DRDO"
269
+ },
270
+ {
271
+ "owner": "Kamlakant",
272
+ "body": "BAU support to PHI"
273
+ },
274
+ {
275
+ "owner": "Kamlakant",
276
+ "body": "Worked on TTML trunk troubleshooting"
277
+ },
278
+ {
279
+ "owner": "Kamlakant",
280
+ "body": "Worked on GC reports validation for mismatch of count"
281
+ },
282
+ {
283
+ "owner": "Kamlakant",
284
+ "body": "Supported actual Go live"
285
+ },
286
+ {
287
+ "owner": "Kamlakant",
288
+ "body": "Configured 2 Ob campaign"
289
+ },
290
+ {
291
+ "owner": "Kamlakant",
292
+ "body": "Configured primary dispositions"
293
+ },
294
+ {
295
+ "owner": "Kamlakant",
296
+ "body": "configured 2 contact list"
297
+ },
298
+ {
299
+ "owner": "Kamlakant",
300
+ "body": "Configured MeddiAssist call flow and make it live"
301
+ },
302
+ {
303
+ "owner": "Kamlakant",
304
+ "body": "Configured MeddiBuddy call flow and make it live"
305
+ },
306
+ {
307
+ "owner": "Kamlakant",
308
+ "body": "Provided data source for required reporting field to PHI"
309
+ },
310
+ {
311
+ "owner": "Pavan Sai",
312
+ "body": "Attended daily calls"
313
+ },
314
+ {
315
+ "owner": "Pavan Sai",
316
+ "body": "Attended project status call"
317
+ },
318
+ {
319
+ "owner": "Pavan Sai",
320
+ "body": "Worked on email blasting for dialtone"
321
+ },
322
+ {
323
+ "owner": "Pavan Sai",
324
+ "body": "Worked on creating sop document for genesys cloud agent login"
325
+ },
326
+ {
327
+ "owner": "Pavan Sai",
328
+ "body": "Worked on testing NTT call flow"
329
+ },
330
+ {
331
+ "owner": "Pavan Sai",
332
+ "body": "Attended NTT calls"
333
+ },
334
+ {
335
+ "owner": "Pavan Sai",
336
+ "body": "Worked on attendance systen testing"
337
+ },
338
+ {
339
+ "owner": "Pavan Sai",
340
+ "body": "Worked on testing NTT call flow"
341
+ },
342
+ {
343
+ "owner": "Pavan Sai",
344
+ "body": "Worked on trade india price updation"
345
+ },
346
+ {
347
+ "owner": "Madhan D",
348
+ "body": "Worked on daily office checklist"
349
+ },
350
+ {
351
+ "owner": "Madhan D",
352
+ "body": "Worked on taking snapshot on Gen Center"
353
+ },
354
+ {
355
+ "owner": "Madhan D",
356
+ "body": "Worked on taking backup on Gen Center"
357
+ },
358
+ {
359
+ "owner": "Madhan D",
360
+ "body": "Worked on following up on ACT internet issue"
361
+ },
362
+ {
363
+ "owner": "Madhan D",
364
+ "body": "Worked on learning Polycom to ZTP"
365
+ },
366
+ {
367
+ "owner": "Madhan D",
368
+ "body": "Worked on moving servers network from Jio to ACT"
369
+ },
370
+ {
371
+ "owner": "Madhan D",
372
+ "body": "Worked on creating and sharing Polycom to ZTP document"
373
+ },
374
+ {
375
+ "owner": "Madhan D",
376
+ "body": "Worked on creating users on GitHub and client location for gathering information"
377
+ },
378
+ {
379
+ "owner": "Madhan D",
380
+ "body": "Worked on troubleshooting agent desktop server"
381
+ },
382
+ {
383
+ "owner": "Madhan D",
384
+ "body": "Worked on fixing printer issue"
385
+ },
386
+ {
387
+ "owner": "Rikki",
388
+ "body": "Worked on New IWD group creation in UAE and Jordan"
389
+ },
390
+ {
391
+ "owner": "Rikki",
392
+ "body": "Worked on Careem pay IVR new segment and Priority Customer number to be updat in database"
393
+ },
394
+ {
395
+ "owner": "Rikki",
396
+ "body": "Worked on Icon Cust or Cust1 tables columns data of IVR attached field name definition to be shared with Careem"
397
+ },
398
+ {
399
+ "owner": "Rikki",
400
+ "body": "Worked on Need to add the Apollo URL with below strategie"
401
+ },
402
+ {
403
+ "owner": "Rikki",
404
+ "body": "Workedon List of all the services running on Egypt TP VMs detials preparation for Careem"
405
+ },
406
+ {
407
+ "owner": "Rikki",
408
+ "body": "Worked on Need to add map new field (shipmentID) in Genesys master voice API"
409
+ },
410
+ {
411
+ "owner": "Sunny",
412
+ "body": "Worked on Careem Daily checklist"
413
+ },
414
+ {
415
+ "owner": "Sunny",
416
+ "body": "Worked on DB server utilization report"
417
+ },
418
+ {
419
+ "owner": "Sunny",
420
+ "body": "Attend NTT calls."
421
+ },
422
+ {
423
+ "owner": "Sunny",
424
+ "body": "Attended PHI calls"
425
+ },
426
+ {
427
+ "owner": "Sunny",
428
+ "body": "Worked on interaction and SLA reports for PHI in Genesys cloud"
429
+ },
430
+ {
431
+ "owner": "Sunny",
432
+ "body": "Worked on updating holiday schedule for PHI in Genesys cloud"
433
+ },
434
+ {
435
+ "owner": "Sunny",
436
+ "body": "Configure Disposition for PHI"
437
+ },
438
+ {
439
+ "owner": "Sunny",
440
+ "body": "Complete the configuration for Plannex, replacing 5 phones"
441
+ }
442
+ ],
443
+ "actions": [
444
+ {
445
+ "owner": "Madhav S",
446
+ "body": "Agent desktop UI integration for admin module",
447
+ "due_date": "2026-08-21",
448
+ "due_note": ""
449
+ },
450
+ {
451
+ "owner": "Madhav S",
452
+ "body": "Abandoned UI for NTT",
453
+ "due_date": "2026-08-20",
454
+ "due_note": ""
455
+ },
456
+ {
457
+ "owner": "Madhav S",
458
+ "body": "Attendance website changes for hosting",
459
+ "due_date": "2026-08-21",
460
+ "due_note": ""
461
+ },
462
+ {
463
+ "owner": "Gokul M",
464
+ "body": "Leave management API for agent desktop",
465
+ "due_date": "2026-08-19",
466
+ "due_note": ""
467
+ },
468
+ {
469
+ "owner": "Gokul M",
470
+ "body": "Leave management UI for agent desktop",
471
+ "due_date": "2026-08-20",
472
+ "due_note": ""
473
+ },
474
+ {
475
+ "owner": "Gokul M",
476
+ "body": "Validation and permissoin for leave management",
477
+ "due_date": "2026-08-21",
478
+ "due_note": ""
479
+ },
480
+ {
481
+ "owner": "Harshitha P",
482
+ "body": "Learn & Explore Rust.js for HR module backend",
483
+ "due_date": "2026-08-17",
484
+ "due_note": ""
485
+ },
486
+ {
487
+ "owner": "Harshitha P",
488
+ "body": "Recruitment & Onboarding API creation for HR module",
489
+ "due_date": "2026-08-19",
490
+ "due_note": ""
491
+ },
492
+ {
493
+ "owner": "Harshitha P",
494
+ "body": "API testing in postman",
495
+ "due_date": "2026-08-20",
496
+ "due_note": ""
497
+ },
498
+ {
499
+ "owner": "Manish J",
500
+ "body": "SEO for smart interactive display",
501
+ "due_date": "2026-08-18",
502
+ "due_note": ""
503
+ },
504
+ {
505
+ "owner": "Manish J",
506
+ "body": "Integrating summary, tenent, user, licence APIs for dashboard UI",
507
+ "due_date": "2026-08-19",
508
+ "due_note": ""
509
+ },
510
+ {
511
+ "owner": "Manish J",
512
+ "body": "Creating API for attendance and time tracking",
513
+ "due_date": "2026-08-21",
514
+ "due_note": ""
515
+ },
516
+ {
517
+ "owner": "Kishan H M",
518
+ "body": "Integrating Licence management APIs for Agent Desktop UI",
519
+ "due_date": "2026-08-19",
520
+ "due_note": ""
521
+ },
522
+ {
523
+ "owner": "Kishan H M",
524
+ "body": "Module Management API modifications",
525
+ "due_date": "2026-08-20",
526
+ "due_note": ""
527
+ },
528
+ {
529
+ "owner": "Kishan H M",
530
+ "body": "Learning Genesys Cloud Communicate",
531
+ "due_date": "2026-08-20",
532
+ "due_note": ""
533
+ },
534
+ {
535
+ "owner": "Pavan Sai",
536
+ "body": "Email blasting for NEC SL 2100",
537
+ "due_date": "2026-08-18",
538
+ "due_note": ""
539
+ },
540
+ {
541
+ "owner": "Pavan Sai",
542
+ "body": "Minimum order quantity updation",
543
+ "due_date": "2026-08-19",
544
+ "due_note": ""
545
+ },
546
+ {
547
+ "owner": "Pavan Sai",
548
+ "body": "Testing CRS",
549
+ "due_date": "2026-08-20",
550
+ "due_note": ""
551
+ },
552
+ {
553
+ "owner": "Madhan D",
554
+ "body": "Testing Network switching on server from ACT to Jio tomorrow",
555
+ "due_date": "2026-08-18",
556
+ "due_note": ""
557
+ },
558
+ {
559
+ "owner": "Madhan D",
560
+ "body": "Changing display on T430 laptop",
561
+ "due_date": "2026-08-19",
562
+ "due_note": ""
563
+ },
564
+ {
565
+ "owner": "Madhan D",
566
+ "body": "Checking pfSense network backup",
567
+ "due_date": "2026-08-20",
568
+ "due_note": ""
569
+ },
570
+ {
571
+ "owner": "Vinay",
572
+ "body": "Api integration with ivr call flow changes",
573
+ "due_date": "2026-08-18",
574
+ "due_note": ""
575
+ },
576
+ {
577
+ "owner": "Vinay",
578
+ "body": "Working on incident rescue team members addition and deletion on Coforge",
579
+ "due_date": "2026-08-19",
580
+ "due_note": ""
581
+ },
582
+ {
583
+ "owner": "Vinay",
584
+ "body": "Trunk recording modification on Coforge",
585
+ "due_date": "2026-08-19",
586
+ "due_note": ""
587
+ },
588
+ {
589
+ "owner": "Kamlakant",
590
+ "body": "CRM/LMS integratoin for CTI",
591
+ "due_date": "2026-08-18",
592
+ "due_note": ""
593
+ },
594
+ {
595
+ "owner": "Kamlakant",
596
+ "body": "Report mismatch issue",
597
+ "due_date": "2026-08-20",
598
+ "due_note": ""
599
+ },
600
+ {
601
+ "owner": "Kamlakant",
602
+ "body": "Phase II requirement gathering for next delivery",
603
+ "due_date": "2026-08-21",
604
+ "due_note": ""
605
+ },
606
+ {
607
+ "owner": "Kamlakant",
608
+ "body": "BAU support",
609
+ "due_date": null,
610
+ "due_note": "In Progress"
611
+ },
612
+ {
613
+ "owner": "Kamlakant",
614
+ "body": "Request to be initiated with Careem for Madhan access",
615
+ "due_date": "2026-08-21",
616
+ "due_note": ""
617
+ },
618
+ {
619
+ "owner": "Kamlakant",
620
+ "body": "Rikki and Madhan on boarding for PHI",
621
+ "due_date": "2026-08-19",
622
+ "due_note": ""
623
+ },
624
+ {
625
+ "owner": "Sunny",
626
+ "body": "Careem Daily checklist",
627
+ "due_date": null,
628
+ "due_note": "Daily"
629
+ },
630
+ {
631
+ "owner": "Sunny",
632
+ "body": "Careem DB server utilizaton report",
633
+ "due_date": null,
634
+ "due_note": "In Progress"
635
+ },
636
+ {
637
+ "owner": "Sunny",
638
+ "body": "Attend NTT calls for phase 2 configuration and phase1 support",
639
+ "due_date": null,
640
+ "due_note": "In Progress"
641
+ },
642
+ {
643
+ "owner": "Rikki",
644
+ "body": "Need to Attend meeting of data center Activity - Rack cable restructuring daily",
645
+ "due_date": null,
646
+ "due_note": "In Progress"
647
+ },
648
+ {
649
+ "owner": "Rikki",
650
+ "body": "Need to prepare POA of DXB server application list if any service goes down during data center Activity",
651
+ "due_date": null,
652
+ "due_note": "In Progress"
653
+ }
654
+ ]
655
+ },
656
+ {
657
+ "file": "MOM_Technical Report on 15-09-2026.xlsx",
658
+ "date": "2026-09-21",
659
+ "title": "Weekly Technical Meeting",
660
+ "location": "Opticent, Bangalore",
661
+ "presenter": "Niranjan",
662
+ "minutes_by": "Gokul M",
663
+ "participants": "Shravan, Kamlakant, Vinay, Gokul, Sunny, Rikki, Madhan, Harshitha,Honey ,Kishan, Madhav,Manish J",
664
+ "updates": [
665
+ {
666
+ "owner": "Madhav S",
667
+ "body": "Attended daily calls"
668
+ },
669
+ {
670
+ "owner": "Madhav S",
671
+ "body": "Attended ad demo call"
672
+ },
673
+ {
674
+ "owner": "Madhav S",
675
+ "body": "Attended project status call"
676
+ },
677
+ {
678
+ "owner": "Madhav S",
679
+ "body": "Worked on admin module integration"
680
+ },
681
+ {
682
+ "owner": "Madhav S",
683
+ "body": "Worked on attendance location finder"
684
+ },
685
+ {
686
+ "owner": "Madhav S",
687
+ "body": "Worked on Fixing sitemaps errors"
688
+ },
689
+ {
690
+ "owner": "Madhav S",
691
+ "body": "Worked on priority queue api for ntt"
692
+ },
693
+ {
694
+ "owner": "Madhav S",
695
+ "body": "Worked on video call requirement gathering"
696
+ },
697
+ {
698
+ "owner": "Madhav S",
699
+ "body": "Worked on click to call for crm"
700
+ },
701
+ {
702
+ "owner": "Harshitha P",
703
+ "body": "Attended daily calls"
704
+ },
705
+ {
706
+ "owner": "Harshitha P",
707
+ "body": "Attended project status calls"
708
+ },
709
+ {
710
+ "owner": "Harshitha P",
711
+ "body": "Worked on Recruitment/onboarding api integration"
712
+ },
713
+ {
714
+ "owner": "Harshitha P",
715
+ "body": "Worked on saving candidates applications in db"
716
+ },
717
+ {
718
+ "owner": "Harshitha P",
719
+ "body": "Worked on saving job postings in db"
720
+ },
721
+ {
722
+ "owner": "Harshitha P",
723
+ "body": "Worked on careers page UI modification"
724
+ },
725
+ {
726
+ "owner": "Harshitha P",
727
+ "body": "Worked on creating apis for articles and knowledge base module"
728
+ },
729
+ {
730
+ "owner": "Harshitha P",
731
+ "body": "Worked on testing apis in postman"
732
+ },
733
+ {
734
+ "owner": "Manish J",
735
+ "body": "Attended Daily calls"
736
+ },
737
+ {
738
+ "owner": "Manish J",
739
+ "body": "Worked on identifying the target keywords for products"
740
+ },
741
+ {
742
+ "owner": "Manish J",
743
+ "body": "Worked on SEO for IPPBX"
744
+ },
745
+ {
746
+ "owner": "Manish J",
747
+ "body": "Worked on UI for attendance & Time tracking"
748
+ },
749
+ {
750
+ "owner": "Manish J",
751
+ "body": "Worked an admin overview"
752
+ },
753
+ {
754
+ "owner": "Manish J",
755
+ "body": "UI for attendane and Time tracking"
756
+ },
757
+ {
758
+ "owner": "Manish J",
759
+ "body": "Worked on admin Reports UI"
760
+ },
761
+ {
762
+ "owner": "Manish J",
763
+ "body": "Worked on sidebar UI for Agend desktop."
764
+ },
765
+ {
766
+ "owner": "Vinay",
767
+ "body": "Worked on Troubleshooting on Webrtc error on Coforge Users"
768
+ },
769
+ {
770
+ "owner": "Vinay",
771
+ "body": "Worked on Voice calarity Issue on Coforge"
772
+ },
773
+ {
774
+ "owner": "Vinay",
775
+ "body": "Worked on Update New Recording policy for Coforge"
776
+ },
777
+ {
778
+ "owner": "Vinay",
779
+ "body": "Webrtc phones configuration for New User for Coforge"
780
+ },
781
+ {
782
+ "owner": "Vinay",
783
+ "body": "Wokred on screen recording recovering on Cofor"
784
+ },
785
+ {
786
+ "owner": "Vinay",
787
+ "body": "Worked on Routing Issue for Afghanishtan Country Number for Coforge"
788
+ },
789
+ {
790
+ "owner": "Vinay",
791
+ "body": "Worked on video Integratoin with GC on NTT"
792
+ },
793
+ {
794
+ "owner": "Vinay",
795
+ "body": "Worked on API Data Action changes on NTT"
796
+ },
797
+ {
798
+ "owner": "Vinay",
799
+ "body": "Worked on IVR Call Flow chnages for Screen pop url for NTT"
800
+ },
801
+ {
802
+ "owner": "Gokul M",
803
+ "body": "Attended daily calls"
804
+ },
805
+ {
806
+ "owner": "Gokul M",
807
+ "body": "Attended project status calls"
808
+ },
809
+ {
810
+ "owner": "Gokul M",
811
+ "body": "Worked on api and ui integration for agent desktop super admin"
812
+ },
813
+ {
814
+ "owner": "Gokul M",
815
+ "body": "Worked on modifying module management api and ui for agent desktop"
816
+ },
817
+ {
818
+ "owner": "Gokul M",
819
+ "body": "Worked on modifying client management api and ui for agent desktop"
820
+ },
821
+ {
822
+ "owner": "Gokul M",
823
+ "body": "Worked on creating knowledge and article base ui for agent desktop"
824
+ },
825
+ {
826
+ "owner": "Gokul M",
827
+ "body": "Worked on creating client login api and ui for agent desktop"
828
+ },
829
+ {
830
+ "owner": "Gokul M",
831
+ "body": "Worked on leave management api and ui for agent desktop"
832
+ },
833
+ {
834
+ "owner": "Gokul M",
835
+ "body": "Worked on complains and grievance api and ui modification for agent desktop"
836
+ },
837
+ {
838
+ "owner": "Gokul M",
839
+ "body": "Worked on dashboard api and ui modification and integration for agent desktop"
840
+ },
841
+ {
842
+ "owner": "Kishan H M",
843
+ "body": "Attended daily calls"
844
+ },
845
+ {
846
+ "owner": "Kishan H M",
847
+ "body": "Attended project status calls"
848
+ },
849
+ {
850
+ "owner": "Kishan H M",
851
+ "body": "Worked on Fixing bugs in CRS"
852
+ },
853
+ {
854
+ "owner": "Kishan H M",
855
+ "body": "Worked on edit APIs creation for CRS"
856
+ },
857
+ {
858
+ "owner": "Kishan H M",
859
+ "body": "Worked on API encryption for Performance Evaluation"
860
+ },
861
+ {
862
+ "owner": "Kishan H M",
863
+ "body": "Worked on learning Genesys cloud contact centre"
864
+ },
865
+ {
866
+ "owner": "Kamlakant",
867
+ "body": "Attended daily call"
868
+ },
869
+ {
870
+ "owner": "Kamlakant",
871
+ "body": "Attended PHI all calls"
872
+ },
873
+ {
874
+ "owner": "Kamlakant",
875
+ "body": "Attended PHI troubleshooting calls"
876
+ },
877
+ {
878
+ "owner": "Kamlakant",
879
+ "body": "Coordination with Teleapps for SCB closer"
880
+ },
881
+ {
882
+ "owner": "Kamlakant",
883
+ "body": "Coordinated with NTT for video integration"
884
+ },
885
+ {
886
+ "owner": "Kamlakant",
887
+ "body": "Coordinated with NTT & PHI for middleware server"
888
+ },
889
+ {
890
+ "owner": "Kamlakant",
891
+ "body": "Coordinated with NTT, TCL and PHI for IB/OB call disconnection issue."
892
+ },
893
+ {
894
+ "owner": "Kamlakant",
895
+ "body": "Worked on recording not playing issue"
896
+ },
897
+ {
898
+ "owner": "Kamlakant",
899
+ "body": "BAU support to PHI"
900
+ },
901
+ {
902
+ "owner": "Kamlakant",
903
+ "body": "Follow-up call attended with PHI for other integrations."
904
+ },
905
+ {
906
+ "owner": "Kamlakant",
907
+ "body": "Setup and attended chatbot integration"
908
+ },
909
+ {
910
+ "owner": "Kamlakant",
911
+ "body": "Worked on competing the SIT of screen recording"
912
+ },
913
+ {
914
+ "owner": "Kamlakant",
915
+ "body": "Worked on SIT for video integration SIT"
916
+ },
917
+ {
918
+ "owner": "Madhan D",
919
+ "body": "worked on daily office checklist"
920
+ },
921
+ {
922
+ "owner": "Madhan D",
923
+ "body": "worked on taken snapshot on xencenter"
924
+ },
925
+ {
926
+ "owner": "Madhan D",
927
+ "body": "worked on taken backup on xencenter"
928
+ },
929
+ {
930
+ "owner": "Madhan D",
931
+ "body": "worked on configuring ntt mail"
932
+ },
933
+ {
934
+ "owner": "Madhan D",
935
+ "body": "worked on ivr bug fixes"
936
+ },
937
+ {
938
+ "owner": "Madhan D",
939
+ "body": "worked on adding user on project optima"
940
+ },
941
+ {
942
+ "owner": "Madhan D",
943
+ "body": "went cleints location for Sophos firewall installation"
944
+ },
945
+ {
946
+ "owner": "Madhan D",
947
+ "body": "worked on adding user on github"
948
+ },
949
+ {
950
+ "owner": "Rikki",
951
+ "body": "Work on Post Call Survey IVR, Routing and Report creation in for FOOD UAE IVR."
952
+ },
953
+ {
954
+ "owner": "Rikki",
955
+ "body": "Work on Need to Share Per Day Recording Count Data to Sheraz from 1st Aug to till date."
956
+ },
957
+ {
958
+ "owner": "Honey S P",
959
+ "body": "Attended Ntt calls"
960
+ },
961
+ {
962
+ "owner": "Honey S P",
963
+ "body": "Worked on CRS testing version 2"
964
+ },
965
+ {
966
+ "owner": "Honey S P",
967
+ "body": "Worked on preparing test cases for genesys screen popup NTT"
968
+ },
969
+ {
970
+ "owner": "Honey S P",
971
+ "body": "Worked on genesys screen popup testing for NTT"
972
+ },
973
+ {
974
+ "owner": "Honey S P",
975
+ "body": "Worked on testing video call feature in genesys NTT"
976
+ },
977
+ {
978
+ "owner": "Honey S P",
979
+ "body": "Worked on validating product prices in india mart"
980
+ },
981
+ {
982
+ "owner": "Honey S P",
983
+ "body": "Worked on testing IVR"
984
+ },
985
+ {
986
+ "owner": "Honey S P",
987
+ "body": "Worked on testing genesys phi call flow"
988
+ },
989
+ {
990
+ "owner": "Sunny",
991
+ "body": "Worked on careem daily checklist"
992
+ },
993
+ {
994
+ "owner": "Sunny",
995
+ "body": "Work on DB servers utilisation report"
996
+ },
997
+ {
998
+ "owner": "Sunny",
999
+ "body": "Attend Phi calls"
1000
+ },
1001
+ {
1002
+ "owner": "Sunny",
1003
+ "body": "Worked on agent unable to make outbound call issue"
1004
+ },
1005
+ {
1006
+ "owner": "Sunny",
1007
+ "body": "Worked on reporting related issues"
1008
+ },
1009
+ {
1010
+ "owner": "Sunny",
1011
+ "body": "Worked on an outbound campaign"
1012
+ },
1013
+ {
1014
+ "owner": "Sunny",
1015
+ "body": "Worked on a phi agent login issue."
1016
+ },
1017
+ {
1018
+ "owner": "Sunny",
1019
+ "body": "Worked on CRM pop up UAT."
1020
+ }
1021
+ ],
1022
+ "actions": [
1023
+ {
1024
+ "owner": "Madhav S",
1025
+ "body": "Sitemaps for opticent website",
1026
+ "due_date": "2026-09-15",
1027
+ "due_note": ""
1028
+ },
1029
+ {
1030
+ "owner": "Madhav S",
1031
+ "body": "Priority queue api console",
1032
+ "due_date": "2026-09-17",
1033
+ "due_note": ""
1034
+ },
1035
+ {
1036
+ "owner": "Madhav S",
1037
+ "body": "Recoding movement details",
1038
+ "due_date": "2026-09-18",
1039
+ "due_note": ""
1040
+ },
1041
+ {
1042
+ "owner": "Gokul M",
1043
+ "body": "Client login api and ui creation",
1044
+ "due_date": "2026-09-15",
1045
+ "due_note": ""
1046
+ },
1047
+ {
1048
+ "owner": "Gokul M",
1049
+ "body": "Api and ui integration for article and knowledge base",
1050
+ "due_date": "2026-09-16",
1051
+ "due_note": ""
1052
+ },
1053
+ {
1054
+ "owner": "Gokul M",
1055
+ "body": "Hr module integration for agent desktopi",
1056
+ "due_date": "2026-09-18",
1057
+ "due_note": ""
1058
+ },
1059
+ {
1060
+ "owner": "Harshitha P",
1061
+ "body": "Asset-linked tickets API creation",
1062
+ "due_date": "2026-09-15",
1063
+ "due_note": ""
1064
+ },
1065
+ {
1066
+ "owner": "Harshitha P",
1067
+ "body": "Asset-linked tickets UI development",
1068
+ "due_date": "2026-09-18",
1069
+ "due_note": ""
1070
+ },
1071
+ {
1072
+ "owner": "Manish J",
1073
+ "body": "Modification of Ul for Attendance and Time tracking",
1074
+ "due_date": "2026-09-15",
1075
+ "due_note": ""
1076
+ },
1077
+ {
1078
+ "owner": "Manish J",
1079
+ "body": "SEO for Audio Conferencing",
1080
+ "due_date": "2026-09-17",
1081
+ "due_note": ""
1082
+ },
1083
+ {
1084
+ "owner": "Manish J",
1085
+ "body": "UI for Career Development",
1086
+ "due_date": "2026-09-18",
1087
+ "due_note": ""
1088
+ },
1089
+ {
1090
+ "owner": "Kishan H M",
1091
+ "body": "Backend API development for Career Development",
1092
+ "due_date": "2026-09-16",
1093
+ "due_note": ""
1094
+ },
1095
+ {
1096
+ "owner": "Kishan H M",
1097
+ "body": "Backend API development for Ticket life cycle management",
1098
+ "due_date": "2026-09-17",
1099
+ "due_note": ""
1100
+ },
1101
+ {
1102
+ "owner": "Kishan H M",
1103
+ "body": "UI development for Ticket life cycle management",
1104
+ "due_date": "2026-09-18",
1105
+ "due_note": ""
1106
+ },
1107
+ {
1108
+ "owner": "Honey S P",
1109
+ "body": "India mart validation",
1110
+ "due_date": "2026-09-15",
1111
+ "due_note": ""
1112
+ },
1113
+ {
1114
+ "owner": "Honey S P",
1115
+ "body": "trade india validation",
1116
+ "due_date": "2026-09-16",
1117
+ "due_note": ""
1118
+ },
1119
+ {
1120
+ "owner": "Honey S P",
1121
+ "body": "NTT testing outbound campaign",
1122
+ "due_date": "2026-09-17",
1123
+ "due_note": ""
1124
+ },
1125
+ {
1126
+ "owner": "Madhan D",
1127
+ "body": "Sophoes firewall config",
1128
+ "due_date": "2026-09-15",
1129
+ "due_note": ""
1130
+ },
1131
+ {
1132
+ "owner": "Madhan D",
1133
+ "body": "Ivr testing",
1134
+ "due_date": "2026-09-16",
1135
+ "due_note": ""
1136
+ },
1137
+ {
1138
+ "owner": "Madhan D",
1139
+ "body": "Gpu upgrade",
1140
+ "due_date": "2026-09-17",
1141
+ "due_note": ""
1142
+ },
1143
+ {
1144
+ "owner": "Madhan D",
1145
+ "body": "Installing os on desktop",
1146
+ "due_date": "2026-09-18",
1147
+ "due_note": ""
1148
+ },
1149
+ {
1150
+ "owner": "Vinay",
1151
+ "body": "SSO Intergrations with GC Troubleshooting NTT",
1152
+ "due_date": null,
1153
+ "due_note": "Waiting for Client"
1154
+ },
1155
+ {
1156
+ "owner": "Vinay",
1157
+ "body": "Troubleshooting Airline IT Calls not ringing on coforge",
1158
+ "due_date": "2026-09-15",
1159
+ "due_note": ""
1160
+ },
1161
+ {
1162
+ "owner": "Vinay",
1163
+ "body": "Alerts confifguation on coforge",
1164
+ "due_date": "2026-09-16",
1165
+ "due_note": ""
1166
+ },
1167
+ {
1168
+ "owner": "Vinay",
1169
+ "body": "Users creation",
1170
+ "due_date": "2026-09-18",
1171
+ "due_note": ""
1172
+ },
1173
+ {
1174
+ "owner": "Kamlakant",
1175
+ "body": "OB UAT",
1176
+ "due_date": "2026-09-15",
1177
+ "due_note": ""
1178
+ },
1179
+ {
1180
+ "owner": "Kamlakant",
1181
+ "body": "ANI,DNIS and preferred language information to be shown in CRM changeser",
1182
+ "due_date": "2026-09-16",
1183
+ "due_note": ""
1184
+ },
1185
+ {
1186
+ "owner": "Kamlakant",
1187
+ "body": "BAU support",
1188
+ "due_date": null,
1189
+ "due_note": "In Progress"
1190
+ },
1191
+ {
1192
+ "owner": "Kamlakant",
1193
+ "body": "OB go live",
1194
+ "due_date": "2026-09-17",
1195
+ "due_note": ""
1196
+ },
1197
+ {
1198
+ "owner": "Kamlakant",
1199
+ "body": "Predictive campaign configuration for sales",
1200
+ "due_date": "2026-09-17",
1201
+ "due_note": ""
1202
+ },
1203
+ {
1204
+ "owner": "Kamlakant",
1205
+ "body": "Careem access for Madhan",
1206
+ "due_date": "2026-09-18",
1207
+ "due_note": ""
1208
+ },
1209
+ {
1210
+ "owner": "Kamlakant",
1211
+ "body": "SSO resolution",
1212
+ "due_date": null,
1213
+ "due_note": "On hold"
1214
+ },
1215
+ {
1216
+ "owner": "Kamlakant",
1217
+ "body": "Registered customer IVR development – Call flow awaited from client",
1218
+ "due_date": "2026-09-18",
1219
+ "due_note": ""
1220
+ },
1221
+ {
1222
+ "owner": "Sunny",
1223
+ "body": "Careem Daily checklist",
1224
+ "due_date": null,
1225
+ "due_note": "Daily"
1226
+ },
1227
+ {
1228
+ "owner": "Sunny",
1229
+ "body": "Careem DB server utilization report",
1230
+ "due_date": "2026-09-19",
1231
+ "due_note": ""
1232
+ },
1233
+ {
1234
+ "owner": "Sunny",
1235
+ "body": "Complete outbound campaign task",
1236
+ "due_date": "2026-09-19",
1237
+ "due_note": ""
1238
+ },
1239
+ {
1240
+ "owner": "Rikki",
1241
+ "body": "IWD ticket timeout 15 minute se 12 minute",
1242
+ "due_date": "2026-09-17",
1243
+ "due_note": ""
1244
+ },
1245
+ {
1246
+ "owner": "Rikki",
1247
+ "body": "Careem_B2B_UAE IVR for Captain in Production.",
1248
+ "due_date": "2026-09-18",
1249
+ "due_note": ""
1250
+ },
1251
+ {
1252
+ "owner": "Rikki",
1253
+ "body": "Routing and Report creation in for FOOD UAE IVR Changes",
1254
+ "due_date": "2026-09-18",
1255
+ "due_note": ""
1256
+ },
1257
+ {
1258
+ "owner": "Rikki",
1259
+ "body": "Food JOR IVR Changes",
1260
+ "due_date": "2026-09-21",
1261
+ "due_note": ""
1262
+ }
1263
+ ]
1264
+ }
1265
+ ]
1266
+ }
setup.bat ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ @echo off
2
+ cd /d "%~dp0"
3
+ echo Setting up the local MOM application...
4
+ where py >nul 2>nul
5
+ if errorlevel 1 (
6
+ echo Install Python 3.11 or newer from python.org, then run this file again.
7
+ pause
8
+ exit /b 1
9
+ )
10
+ py -3 -m venv .venv
11
+ if errorlevel 1 exit /b 1
12
+ ".venv\Scripts\python.exe" -m pip install -r requirements.txt
13
+ if errorlevel 1 exit /b 1
14
+ echo Setup complete. Double-click start_mom.bat to open the app.
setup_routes.py ADDED
@@ -0,0 +1,124 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import json
2
+ import re
3
+ import secrets
4
+ from datetime import date, timedelta
5
+ from pathlib import Path
6
+ from flask import abort, flash, g, redirect, render_template, request, session, url_for
7
+ from werkzeug.security import generate_password_hash
8
+ from werkzeug.utils import secure_filename
9
+ from importer import parse_report, suggest_owner
10
+ from seed import DEFAULT_PASSWORD
11
+
12
+ def register_setup(app,db,admin_only):
13
+ def pending():
14
+ key=session.get('pending_import','')
15
+ if not re.fullmatch('[a-f0-9]{32}',key):
16
+ return None
17
+ path=Path(app.config['DATABASE']).parent/'imports'/(key+'.json')
18
+ return json.loads(path.read_text(encoding='utf-8')) if path.exists() else None
19
+
20
+ @app.route('/setup',methods=['GET','POST'])
21
+ @admin_only
22
+ def setup():
23
+ complete=db().execute("SELECT 1 FROM metadata WHERE key='setup_complete'").fetchone()
24
+ if complete:
25
+ flash('First-run setup is already complete. Your weekly meetings now carry actions forward automatically.','info')
26
+ return redirect(url_for('admin'))
27
+ users=db().execute('SELECT * FROM users ORDER BY name').fetchall()
28
+ preview=pending()
29
+ if request.method=='POST':
30
+ try:
31
+ operation=request.form.get('operation')
32
+ if operation=='upload':
33
+ file=request.files.get('report')
34
+ if not file or not file.filename.lower().endswith('.xlsx'):
35
+ raise ValueError('Select an Excel .xlsx MOM report.')
36
+ content=file.read(10*1024*1024+1)
37
+ if len(content)>10*1024*1024:
38
+ raise ValueError('The workbook must be 10 MB or smaller.')
39
+ preview=parse_report(content)
40
+ key=secrets.token_hex(16)
41
+ directory=Path(app.config['DATABASE']).parent/'imports'
42
+ directory.mkdir(exist_ok=True)
43
+ name=secure_filename(file.filename) or 'previous-report.xlsx'
44
+ preview.update(filename=name,key=key)
45
+ (directory/(key+'.xlsx')).write_bytes(content)
46
+ (directory/(key+'.json')).write_text(json.dumps(preview),encoding='utf-8')
47
+ session['pending_import']=key
48
+ db().commit()
49
+ return redirect(url_for('setup'))
50
+ if operation not in ('confirm','sample'):
51
+ abort(400)
52
+ if operation=='confirm' and not preview:
53
+ raise ValueError('Upload the previous report first.')
54
+ try:
55
+ meeting_date=date.fromisoformat(request.form.get('meeting_date',''))
56
+ report_date=date.fromisoformat(request.form.get('report_date','')) if operation=='confirm' else date(2026,9,21)
57
+ except ValueError:
58
+ raise ValueError('Enter valid previous and upcoming meeting dates.') from None
59
+ if meeting_date.weekday()!=0 or report_date.weekday()!=0:
60
+ raise ValueError('Both meeting dates must be Mondays. Use the actual date if the filename is old.')
61
+ if meeting_date<=report_date:
62
+ raise ValueError('The upcoming meeting must be after the previous report.')
63
+ coordinator=db().execute('SELECT * FROM users WHERE id=? AND active=1 AND rotation_order IS NOT NULL',(request.form.get('coordinator_id'),)).fetchone()
64
+ if not coordinator:
65
+ raise ValueError('Choose the coordinator for the upcoming meeting.')
66
+ current=db().execute("SELECT * FROM meetings WHERE status='active'").fetchone()
67
+ existing=db().execute('SELECT * FROM meetings WHERE meeting_date=? AND id!=?',(meeting_date.isoformat(),current['id'])).fetchone()
68
+ if existing:
69
+ raise ValueError('A historical meeting already uses the upcoming date. Choose a later Monday.')
70
+ if db().execute('SELECT 1 FROM updates WHERE meeting_id=? UNION SELECT 1 FROM actions WHERE meeting_id=?',(current['id'],current['id'])).fetchone():
71
+ raise ValueError('Setup cannot replace the checklist after people have started entering updates.')
72
+ db().execute('UPDATE meetings SET meeting_date=? WHERE id=?',(meeting_date.isoformat(),current['id']))
73
+ if operation=='confirm':
74
+ mappings={}
75
+ for index,name in enumerate(preview['owners']):
76
+ value=request.form.get(f'owner_{index}','')
77
+ user=db().execute('SELECT * FROM users WHERE id=?',(value,)).fetchone()
78
+ if value=='new':
79
+ username=secure_filename(name).lower().replace(' ','_') or 'participant'
80
+ username=username[:50]+'_'+secrets.token_hex(3)
81
+ uid=db().execute('INSERT INTO users(name,username,password_hash,active,rotation_order) VALUES(?,?,?,0,NULL)',(name[:100],username,generate_password_hash(DEFAULT_PASSWORD))).lastrowid
82
+ elif user:
83
+ uid=user['id']
84
+ else:
85
+ raise ValueError(f'Choose the matching person for {name}.')
86
+ mappings[name]=uid
87
+ # Sample reports are only baseline data until this first-run confirmation.
88
+ db().execute('DELETE FROM reviews WHERE meeting_id=?',(current['id'],))
89
+ db().execute('UPDATE actions SET archived=1')
90
+ collision=db().execute('SELECT * FROM meetings WHERE meeting_date=? AND id!=?',(report_date.isoformat(),current['id'])).fetchone()
91
+ if collision:
92
+ if not collision['source_file']:
93
+ raise ValueError('A meeting already exists for the previous report date.')
94
+ mid=collision['id']
95
+ db().execute('DELETE FROM reviews WHERE action_id IN (SELECT id FROM actions WHERE meeting_id=?)',(mid,))
96
+ db().execute('DELETE FROM updates WHERE meeting_id=?',(mid,))
97
+ db().execute('DELETE FROM actions WHERE meeting_id=?',(mid,))
98
+ db().execute('DELETE FROM submissions WHERE meeting_id=?',(mid,))
99
+ else:
100
+ mid=db().execute('INSERT INTO meetings(meeting_date,title,location,status) VALUES(?,?,?,?)',(report_date.isoformat(),preview['title'],preview['location'],'closed')).lastrowid
101
+ db().execute('UPDATE meetings SET title=?,location=?,presenter=?,source_file=?,minutes_by=? WHERE id=?',
102
+ (preview['title'],preview['location'],preview['presenter'],'upload:'+preview['key']+'.xlsx','Imported report',mid))
103
+ for name,uid in mappings.items():
104
+ db().execute('INSERT OR REPLACE INTO report_owner_aliases(meeting_id,source_name,user_id) VALUES(?,?,?)',(mid,name,uid))
105
+ for update in preview['updates']:
106
+ db().execute('INSERT INTO updates(meeting_id,user_id,body) VALUES(?,?,?)',(mid,mappings[update['owner']],update['body']))
107
+ for action in preview['actions']:
108
+ db().execute('INSERT INTO actions(meeting_id,user_id,body,due_date,due_note,completed) VALUES(?,?,?,?,?,?)',
109
+ (mid,mappings[action['owner']],action['body'],action['due_date'],action['due_note'],int(action['completed'])))
110
+ for uid in set(mappings.values()):
111
+ db().execute('INSERT INTO submissions(meeting_id,user_id,reviewed,submitted_at) VALUES(?,?,1,?)',(mid,uid,report_date.isoformat()+' 00:00:00'))
112
+ db().execute('INSERT INTO reviews(meeting_id,action_id) SELECT ?,id FROM actions WHERE meeting_id=? AND completed=0',(current['id'],mid))
113
+ db().execute('UPDATE meetings SET meeting_date=?,coordinator_id=?,minutes_by=? WHERE id=?',(meeting_date.isoformat(),coordinator['id'],coordinator['name'],current['id']))
114
+ db().execute("INSERT INTO metadata(key,value) VALUES('setup_complete','1')")
115
+ db().commit()
116
+ session.pop('pending_import',None)
117
+ flash('Setup complete. Previous actions are ready for the team and this week’s report coordinator.','success')
118
+ return redirect(url_for('dashboard'))
119
+ except ValueError as error:
120
+ db().rollback()
121
+ flash(str(error),'error')
122
+ current=db().execute("SELECT * FROM meetings WHERE status='active'").fetchone()
123
+ mapping={name:suggest_owner(name,users) for name in preview['owners']} if preview else {}
124
+ return render_template('setup.html',preview=preview,users=users,mapping=mapping,meeting=current)
start_mom.bat ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ @echo off
2
+ cd /d "%~dp0"
3
+ if not exist ".venv\Scripts\python.exe" (
4
+ call setup.bat
5
+ if errorlevel 1 exit /b 1
6
+ )
7
+ ".venv\Scripts\python.exe" launcher.py
8
+ if errorlevel 1 pause
static/app.js ADDED
@@ -0,0 +1,196 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 'use strict';
2
+ document.querySelectorAll('[data-password]').forEach(button => {
3
+ button.addEventListener('click', () => {
4
+ const field = document.getElementById(button.dataset.password);
5
+ field.type = field.type === 'password' ? 'text' : 'password';
6
+ button.textContent = field.type === 'password' ? 'Show' : 'Hide';
7
+ });
8
+ });
9
+ const dirtyForms = new Set();
10
+ document.querySelectorAll('form[data-dirty]').forEach(form => {
11
+ form.addEventListener('input', () => dirtyForms.add(form));
12
+ form.addEventListener('change', () => dirtyForms.add(form));
13
+ });
14
+ document.querySelectorAll('form').forEach(form => {
15
+ form.addEventListener('submit', event => {
16
+ if (form.dataset.confirm && !window.confirm(form.dataset.confirm)) {
17
+ event.preventDefault();
18
+ return;
19
+ }
20
+ if ([...dirtyForms].some(dirty => dirty !== form) && !window.confirm('Another form has unsaved changes. Leave without saving those changes?')) {
21
+ event.preventDefault();
22
+ return;
23
+ }
24
+ dirtyForms.clear();
25
+ });
26
+ });
27
+ window.addEventListener('beforeunload', event => {
28
+ if (dirtyForms.size) {
29
+ event.preventDefault();
30
+ event.returnValue = '';
31
+ }
32
+ });
33
+ document.querySelectorAll('.char-counter').forEach(counter => {
34
+ const field = document.getElementById(counter.dataset.for);
35
+ const update = () => { counter.textContent = `${field.value.length} / 3000 characters · One clear item per entry`; };
36
+ field.addEventListener('input', update);
37
+ update();
38
+ });
39
+ document.getElementById('print-report')?.addEventListener('click', () => window.print());
40
+ document.querySelectorAll('form').forEach(form => {
41
+ const operation = form.querySelector('input[name="operation"][value="add"]');
42
+ if (!operation || form.querySelector('input[name="due_date"]')) return;
43
+ const label = document.createElement('label');
44
+ label.htmlFor = 'entry_mode';
45
+ label.textContent = 'Update entry';
46
+ const select = document.createElement('select');
47
+ select.id = 'entry_mode';
48
+ select.name = 'entry_mode';
49
+ select.innerHTML = '<option value="single">One update</option><option value="bulk">Multiple updates (one per line)</option>';
50
+ label.append(select);
51
+ operation.after(label);
52
+ });
53
+ document.querySelectorAll('form').forEach(form => {
54
+ const operation = form.querySelector('input[name="operation"][value="add"]');
55
+ const body = form.querySelector('textarea[name="body"]');
56
+ if (!operation || !body || form.querySelector('input[name="due_date"]')) return;
57
+ const submitButton = form.querySelector('button[type="submit"], button:not([type])');
58
+ form.addEventListener('submit', event => {
59
+ const entries = body.value.split(/\r?\n/).map(line => line.trim()).filter(Boolean);
60
+ if (entries.length < 2 || form.dataset.previewConfirmed === 'true') return;
61
+ if (form.querySelector('[data-update-preview]')) {
62
+ event.preventDefault();
63
+ return;
64
+ }
65
+ event.preventDefault();
66
+ const preview = document.createElement('div');
67
+ preview.className = 'notice';
68
+ preview.dataset.updatePreview = 'true';
69
+ preview.innerHTML = '<strong>Review these updates before saving:</strong>';
70
+ const list = document.createElement('ol');
71
+ entries.forEach(entry => {
72
+ const item = document.createElement('li');
73
+ item.textContent = entry;
74
+ list.append(item);
75
+ });
76
+ const cancel = document.createElement('button');
77
+ cancel.type = 'button';
78
+ cancel.className = 'button secondary';
79
+ cancel.textContent = 'Cancel';
80
+ cancel.addEventListener('click', () => {
81
+ preview.remove();
82
+ if (submitButton) submitButton.disabled = false;
83
+ });
84
+ const save = document.createElement('button');
85
+ save.type = 'button';
86
+ save.className = 'button';
87
+ save.textContent = 'Save these updates';
88
+ save.addEventListener('click', () => {
89
+ form.dataset.previewConfirmed = 'true';
90
+ preview.remove();
91
+ body.disabled = true;
92
+ entries.forEach(entry => {
93
+ const input = document.createElement('input');
94
+ input.type = 'hidden';
95
+ input.name = 'body';
96
+ input.value = entry;
97
+ form.append(input);
98
+ });
99
+ form.requestSubmit();
100
+ });
101
+ preview.append(list, cancel, save);
102
+ form.prepend(preview);
103
+ if (submitButton) submitButton.disabled = true;
104
+ });
105
+ });
106
+ document.querySelectorAll('form').forEach(form => {
107
+ const operation = form.querySelector('input[name="operation"][value="add"]');
108
+ const body = form.querySelector('textarea[name="body"]');
109
+ const dueDate = form.querySelector('input[name="due_date"]');
110
+ if (!operation || !body || !dueDate) return;
111
+ const modeLabel = document.createElement('label');
112
+ modeLabel.htmlFor = 'action_entry_mode';
113
+ modeLabel.textContent = 'Action entry';
114
+ const mode = document.createElement('select');
115
+ mode.id = 'action_entry_mode';
116
+ mode.name = 'action_entry_mode';
117
+ mode.innerHTML = '<option value="single">One action</option><option value="bulk">Multiple actions (one per line)</option>';
118
+ modeLabel.append(mode);
119
+ operation.after(modeLabel);
120
+ const updateActionMode = () => {
121
+ dueDate.required = mode.value !== 'bulk';
122
+ dueDate.disabled = mode.value === 'bulk';
123
+ };
124
+ mode.addEventListener('change', updateActionMode);
125
+ updateActionMode();
126
+ const submitButton = form.querySelector('button[type="submit"], button:not([type])');
127
+ form.addEventListener('submit', event => {
128
+ const entries = body.value.split(/\r?\n/).map(line => {
129
+ const match = line.match(/^\s*\d+\.\s*(?:\[(.*?)\]|(.*?))\s*(?:\[(.*?)\])?\s*$/);
130
+ if (!match) return null;
131
+ const value = (match[3] || '').trim();
132
+ const isDate = /^\d{4}-\d{2}-\d{2}$/.test(value);
133
+ return { body: (match[1] || match[2]).trim(), due: isDate ? value : '', note: isDate ? '' : value };
134
+ }).filter(Boolean);
135
+ if ((mode.value !== 'bulk' && entries.length < 2) || form.dataset.previewConfirmed === 'true') return;
136
+ event.preventDefault();
137
+ if (form.querySelector('[data-action-preview]')) return;
138
+ const preview = document.createElement('div');
139
+ preview.className = 'notice';
140
+ preview.dataset.actionPreview = 'true';
141
+ preview.innerHTML = '<strong>Review these actions before saving:</strong>';
142
+ const list = document.createElement('ol');
143
+ entries.forEach(entry => {
144
+ const item = document.createElement('li');
145
+ item.textContent = `${entry.body} - ${entry.due ? `Due ${entry.due}` : entry.note || 'No due date'}`;
146
+ list.append(item);
147
+ });
148
+ const cancel = document.createElement('button');
149
+ cancel.type = 'button';
150
+ cancel.className = 'button secondary';
151
+ cancel.textContent = 'Cancel';
152
+ cancel.addEventListener('click', () => {
153
+ preview.remove();
154
+ if (submitButton) submitButton.disabled = false;
155
+ });
156
+ const save = document.createElement('button');
157
+ save.type = 'button';
158
+ save.className = 'button';
159
+ save.textContent = 'Save these actions';
160
+ save.addEventListener('click', () => {
161
+ form.dataset.previewConfirmed = 'true';
162
+ preview.remove();
163
+ body.disabled = true;
164
+ dueDate.disabled = true;
165
+ entries.forEach((entry, index) => {
166
+ const bodyInput = document.createElement('input');
167
+ bodyInput.type = 'hidden';
168
+ bodyInput.name = 'body';
169
+ bodyInput.value = `${index + 1}. ${entry.body}${entry.due ? ` [${entry.due}]` : entry.note ? ` [${entry.note}]` : ''}`;
170
+ form.append(bodyInput);
171
+ const dateInput = document.createElement('input');
172
+ dateInput.type = 'hidden';
173
+ dateInput.name = 'due_date';
174
+ dateInput.value = entry.due;
175
+ form.append(dateInput);
176
+ const noteInput = document.createElement('input');
177
+ noteInput.type = 'hidden';
178
+ noteInput.name = 'due_note';
179
+ noteInput.value = entry.note;
180
+ form.append(noteInput);
181
+ });
182
+ form.requestSubmit();
183
+ });
184
+ preview.append(list, cancel, save);
185
+ form.prepend(preview);
186
+ if (submitButton) submitButton.disabled = true;
187
+ });
188
+ });
189
+ document.querySelectorAll('input[name="due_date"]').forEach(field => {
190
+ const meetingDate = new Date(`${field.min}T00:00:00`);
191
+ const formatDate = value => value.toISOString().slice(0, 10);
192
+ meetingDate.setDate(meetingDate.getDate() - 7);
193
+ field.min = formatDate(meetingDate);
194
+ meetingDate.setDate(meetingDate.getDate() + 14);
195
+ field.max = formatDate(meetingDate);
196
+ });
static/style.css ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ :root{--ink:#203531;--muted:#74807b;--green:#28594a;--green-dark:#1b4035;--mint:#eaf2ed;--border:#e3e8e2;--paper:#f6f7f3;--white:#fff;--amber:#926029;--red:#ad423a;--radius:14px}
2
+ *{box-sizing:border-box}body{margin:0;font-family:'Segoe UI',Arial,sans-serif;color:var(--ink);background:var(--paper);font-size:14px;line-height:1.55}a{color:var(--green);text-decoration:none}a:hover{text-decoration:underline}button,input,select,textarea{font:inherit}button,a,input,select,textarea,summary{-webkit-tap-highlight-color:transparent}button{cursor:pointer}button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible,summary:focus-visible{outline:3px solid #b6d6c7;outline-offset:3px}h1,h2,h3,p{margin-top:0}h1{font-size:34px;line-height:1.2;font-weight:600;letter-spacing:-1.1px;margin-bottom:12px}h2{font-size:20px;line-height:1.3;font-weight:600;letter-spacing:-.4px;margin-bottom:10px}h3{font-size:15px;font-weight:600;margin-bottom:4px}p{margin-bottom:16px}small,.small{font-size:12px}.muted{color:var(--muted)}.eyebrow{display:block;font-size:11px;font-weight:650;letter-spacing:1.8px;margin-bottom:12px;color:var(--green)}.sidebar{position:fixed;inset:0 auto 0 0;width:248px;background:#fff;border-right:1px solid var(--border);padding:34px 22px 24px;display:flex;flex-direction:column;z-index:10}.brand{display:flex;align-items:center;gap:12px;font-size:24px;line-height:1.1;font-weight:700;letter-spacing:1px;color:var(--ink);text-decoration:none!important}.brand-icon{display:grid;place-items:center;background:var(--green);color:#fff;border-radius:12px;width:43px;height:43px;font-size:31px;font-family:Georgia,serif;letter-spacing:-2px;padding-bottom:5px}.brand-sub{display:block;font-size:8px;letter-spacing:1.8px;color:var(--muted);margin-top:7px}.nav-label{font-size:10px;letter-spacing:1.4px;color:#929b96;margin:49px 12px 12px}.sidebar nav{display:grid;gap:7px}.sidebar nav a{color:#6a7973;padding:13px 14px;border-radius:9px;display:flex;gap:14px;align-items:center;font-weight:500}.sidebar nav a:hover{background:#f4f6f1;text-decoration:none}.sidebar nav .selected{background:var(--mint);color:var(--green);font-weight:650}.sidebar nav a>span{font-size:20px;width:18px;text-align:center;line-height:1}.sidebar-bottom{margin-top:auto;padding-top:30px}.local-note{font-size:11px;color:var(--muted);margin:0 7px 23px;display:flex;gap:7px;align-items:center}.dot{display:inline-block;width:6px;height:6px;border-radius:50%;background:#68a281;flex:none}.profile{display:flex;align-items:center;gap:11px;border-top:1px solid var(--border);padding-top:22px}.avatar{display:inline-flex;width:36px;height:36px;border-radius:50%;background:#e7ede2;color:#4f6850;align-items:center;justify-content:center;font-size:14px;font-weight:600;flex:none}.profile strong{font-size:13px}.profile small{display:block;color:var(--muted);font-size:11px}.profile-links{display:flex;justify-content:space-between;gap:5px;font-size:10px;margin-top:17px}.link{border:0;background:transparent;padding:0;color:var(--green);font-size:inherit;font-weight:500}.link:hover{text-decoration:underline}.main{margin-left:248px}.topbar{height:77px;border-bottom:1px solid var(--border);display:flex;justify-content:space-between;align-items:center;padding:0 44px;color:#62736a;font-size:12px;background:rgba(255,255,255,.55)}.topbar .muted{padding:0 10px;color:#bdc7bd}.today{font-size:11px}.content{max-width:1360px;margin:auto;padding:39px 44px 60px}.page-heading{margin-bottom:30px}.page-heading p{color:var(--muted);margin-bottom:0;font-size:14px}.heading-row{display:flex;justify-content:space-between;align-items:center;gap:20px}.pill{display:inline-flex;align-items:center;gap:7px;padding:5px 10px;background:#eff2ed;border-radius:30px;font-size:11px;white-space:nowrap;color:#617466;font-weight:500}.pill.green{color:#326848;background:#e8f3e9}.pill.amber{color:#966124;background:#faf0df}.button{display:inline-flex;justify-content:center;align-items:center;gap:20px;padding:12px 20px;background:var(--green);color:#fff;border:1px solid var(--green);border-radius:8px;font-weight:600;font-size:13px;line-height:1.5;white-space:nowrap;transition:background .15s}.button:hover{background:var(--green-dark);text-decoration:none}.button.secondary{background:#fff;color:var(--green);border-color:#dce3d9}.button.secondary:hover{background:var(--mint)}.button.light{background:#f5f7ed;color:var(--green-dark);border-color:#f5f7ed}.button.light:hover{background:#fff}.button.full{display:flex;width:100%}.button-group{display:flex;gap:10px;align-items:center}.small-button{padding:8px 13px}.meeting-banner{background:var(--green);border-radius:16px;padding:29px 32px;color:#fff;display:flex;justify-content:space-between;gap:24px;align-items:center}.meeting-banner .eyebrow{color:#b6d1bd;font-size:10px;letter-spacing:1.4px}.meeting-banner h2{font-size:27px;letter-spacing:-.7px}.meeting-banner p{color:#c8dbce;font-size:13px;margin-bottom:23px}.banner-note{font-size:12px;color:#d8e5d9}.banner-action{display:grid;gap:17px;min-width:205px;text-align:center}.banner-action small{font-size:10px;color:#c1d5c5}.stat-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:20px;margin:24px 0 29px}.stat{background:#fff;border:1px solid var(--border);border-radius:var(--radius);padding:24px;position:relative}.stat>span:not(.stat-icon){display:block;color:var(--muted);font-size:12px;margin-bottom:8px;padding-right:25px}.stat strong{font-size:34px;font-weight:550;letter-spacing:-1px;line-height:1.2}.stat strong small{font-size:19px;font-weight:400;color:#9aa59a;letter-spacing:0}.stat-icon{position:absolute;right:20px;top:24px;font-size:19px;color:#7d9583}.dashboard-grid{display:grid;grid-template-columns:1.1fr 1fr;gap:24px}.card{background:#fff;border:1px solid var(--border);padding:26px;border-radius:var(--radius);min-width:0}.section-heading{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:19px}.section-heading h2{font-size:17px;margin:0}.section-heading a{font-size:11px}.guide-row{display:flex;align-items:flex-start;gap:17px;padding:19px 0}.guide-row+.guide-row{border-top:1px solid #edf0e9}.step-number{display:grid;place-items:center;border:1px solid #dce5d9;width:31px;height:31px;flex:none;border-radius:50%;color:#587563;font-size:12px}.guide-row p{font-size:12px;color:var(--muted);margin:0;line-height:1.7}.recent-row{display:flex;align-items:center;gap:15px;border-bottom:1px solid #edf0e9;padding:17px 0;color:var(--ink)}.recent-row:hover{text-decoration:none;color:var(--green)}.recent-row>span:last-child{margin-left:auto;color:#809682}.recent-row small{display:block;color:var(--muted);font-size:11px;margin-top:3px}.recent-row strong{font-size:13px;font-weight:600}.calendar-icon{width:40px;height:43px;border:1px solid #e0e7dc;border-top:4px solid #ccdacb;border-radius:6px;display:grid;place-items:center;font-size:17px;color:#617858}.source-note{margin:20px 0 0;font-size:11px;line-height:1.8}.flash{border:1px solid #cee1d2;border-radius:9px;padding:13px 18px;margin-bottom:23px;background:#eff8ef;color:#356449;font-size:13px}.flash.error{background:#fff1ee;border-color:#f0cec7;color:#963f32}.flash.info{background:#edf3f6;border-color:#d7e2e8;color:#526b77}.auth-main>.flash,.auth-main>div>.flash{position:relative;margin:15px}.login-layout{min-height:100vh;display:grid;grid-template-columns:46% 54%}.login-story{background:#eaf0e6;padding:48px 11%;display:flex;flex-direction:column;position:relative;overflow:hidden}.story-copy{margin:auto 0;padding:85px 0 100px}.story-copy h1{font-family:Georgia,'Times New Roman',serif;font-weight:400;font-size:58px;line-height:1.12;letter-spacing:-1.9px;color:#264b3d}.story-copy p{font-size:15px;line-height:1.9;color:#758575;max-width:330px;margin-top:24px}.story-steps{display:grid;gap:20px;margin-top:40px;color:#4d6c56;font-size:13px}.story-steps div{display:flex;align-items:center;gap:15px}.story-steps span{font-size:10px;border:1px solid #c9d6c3;border-radius:50%;width:27px;height:27px;display:grid;place-items:center}.story-footer{font-size:11px;display:flex;gap:8px;align-items:center;color:#6b816b}.login-panel{display:grid;place-items:center;background:#fcfcf9;padding:50px 35px}.login-form{width:100%;max-width:385px}.login-form h2{font-size:27px;letter-spacing:-.7px;margin-bottom:11px}.login-form>.muted{font-size:13px;margin-bottom:33px;max-width:320px}.login-form .eyebrow{font-size:10px;color:#8b9c8b}label{display:block;font-size:12px;font-weight:600;color:#53675a;margin:16px 0 8px}input:not([type=hidden]):not([type=checkbox]),select,textarea{width:100%;border:1px solid #d8e0d5;border-radius:7px;background:#fff;color:var(--ink);padding:12px 13px;font-size:13px;line-height:1.5}textarea{resize:vertical;min-height:90px}textarea::placeholder{color:#9ca89d}input[type=checkbox]{appearance:auto;width:19px;height:19px;accent-color:var(--green);margin:4px 0 0;flex:none}form>.button{margin-top:23px}.password-wrap{position:relative}.password-wrap input{padding-right:60px!important}.show-password{position:absolute;right:12px;top:12px;background:transparent;border:0;color:#647a69;font-size:11px;padding:2px}.login-form .button{margin-top:28px;justify-content:space-between}.help-box{border-top:1px solid var(--border);margin-top:36px;padding-top:23px}.help-box strong{font-size:12px;font-weight:600}.help-box p{font-size:12px;color:#859182;line-height:1.8;margin:7px 0 26px}.narrow{max-width:600px}.field-hint{font-size:11px;color:var(--muted);margin:7px 0 14px}.stepper{display:grid;grid-template-columns:repeat(4,1fr);gap:0;margin:0 0 28px;border-bottom:1px solid var(--border)}.stepper a{color:#909b92;display:flex;align-items:center;gap:10px;font-size:12px;padding:0 0 20px;border-bottom:2px solid transparent;margin-bottom:-1px}.stepper a>span{display:grid;place-items:center;width:26px;height:26px;border-radius:50%;border:1px solid #d8e1d6;font-size:11px}.stepper a.current{color:var(--green);border-color:var(--green);font-weight:600}.stepper a.current>span{background:var(--green);color:#fff;border-color:var(--green)}.stepper a.done{color:#598062}.count{border-radius:6px;background:#f0f3ed;color:#7a9078;font-size:12px;min-width:28px;text-align:center;padding:4px 7px}.check-row{display:flex;align-items:flex-start;gap:17px;padding:20px 0;margin:0;border-top:1px solid #edf0e8;cursor:pointer}.check-content{display:block;min-width:0}.check-content strong{font-size:14px;font-weight:500;color:var(--ink);overflow-wrap:anywhere;white-space:pre-wrap}.item-meta{display:flex;gap:17px;flex-wrap:wrap;color:#8b9889;font-size:11px;margin-top:7px;font-weight:400}.overdue{color:#b16e43}.check-row:has(input:checked) strong{color:#7c8d7b;text-decoration:line-through}.flow-footer{display:flex;justify-content:space-between;align-items:center;gap:20px;padding-top:25px}.flow-footer form>.button{margin-top:0}.entry-grid{display:grid;grid-template-columns:.9fr 1.1fr;gap:24px;align-items:start}.entry-compose{position:sticky;top:24px}.entry-compose>p{margin:17px 0 0;font-size:11px;line-height:1.8}.entry-compose label:first-of-type{margin-top:24px}.entry-item{display:flex;gap:16px;border-top:1px solid #edf0e8;padding:21px 0}.entry-item:last-child{padding-bottom:0}.item-number{font-size:11px;color:#9aab98;padding-top:3px}.entry-text{flex:1;min-width:0}.entry-text>p{font-size:13px;line-height:1.8;margin-bottom:10px;white-space:pre-wrap;overflow-wrap:anywhere}details{margin-top:10px}summary{font-size:11px;color:#658465;cursor:pointer}.delete-form{margin-top:8px;font-size:11px}.danger{color:var(--red)}.empty{text-align:center;padding:50px 10px}.empty>span{display:grid;place-items:center;width:48px;height:48px;background:#f1f4ed;color:#799276;border-radius:50%;font-size:23px;margin:0 auto 20px}.empty p{font-size:12px;color:var(--muted);margin:8px auto 0;max-width:260px}.spaced{margin-top:23px}.review-summary{display:flex;gap:20px;justify-content:space-between;padding:19px 24px;background:#eaf0e5;border-radius:10px;color:#57724f;font-size:12px;margin-bottom:25px}.review-row{display:flex;align-items:flex-start;gap:18px;padding:16px 0;border-top:1px solid #edf0e8}.review-row p{font-size:13px;line-height:1.8;margin:0;white-space:pre-wrap;overflow-wrap:anywhere}.report-list{padding-left:20px;font-size:13px;margin:12px 0 0}.report-list li{padding:5px 0 5px 5px;line-height:1.8;white-space:pre-wrap;overflow-wrap:anywhere}.report-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:22px}.report-card>h2{font-size:24px;margin-top:27px}.report-card>p{font-size:13px;margin-bottom:8px}.report-card>p.small{font-size:11px}.report-counts{display:flex;gap:20px;border-top:1px solid var(--border);margin:23px 0;padding-top:18px;font-size:11px;color:var(--muted)}.report-counts strong{font-weight:600;color:var(--ink);margin-right:3px}.report-meta{display:grid;grid-template-columns:repeat(3,1fr);gap:20px;padding:24px 0;border-top:1px solid var(--border);border-bottom:1px solid var(--border);margin-bottom:24px}.report-meta span{display:block;font-size:11px;color:var(--muted);margin-bottom:6px}.report-meta strong{font-size:13px;font-weight:500}.notice{padding:15px 20px;margin-bottom:24px;background:#edf1e8;border-radius:9px;color:#788570;font-size:12px;line-height:1.8}.notice a{display:inline-block;margin-left:6px}.person-section{border-top:1px solid var(--border);padding:23px 0}.person-section:last-child{padding-bottom:0}.person-heading{display:flex;align-items:center;gap:11px}.person-heading h3{margin:0}.person-heading .pill{margin-left:auto}.person-section .report-list{padding-left:65px}.table-scroll{overflow:auto}table{border-collapse:collapse;width:100%;text-align:left;font-size:12px}th{color:#80907c;font-size:10px;text-transform:uppercase;letter-spacing:.8px;background:#f5f7f2;font-weight:600}th,td{padding:14px 12px;vertical-align:top;border-bottom:1px solid #e9eee5}td{line-height:1.8}td small{display:block;color:var(--muted);font-size:10px;margin-top:6px}.wide-cell{min-width:250px;white-space:pre-wrap;overflow-wrap:anywhere}td strong{font-weight:550}.admin-actions{display:grid;gap:8px;font-size:11px;white-space:nowrap}.form-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:3px 20px}.error-card{margin:50px auto;max-width:640px;padding:45px}.text-link{font-size:12px;white-space:nowrap}
3
+ @media(min-width:1600px){.content{padding-top:55px}.login-story{padding-left:15%;padding-right:14%}.story-copy h1{font-size:72px}}
4
+ @media(max-width:1150px){.sidebar{width:210px;padding-left:16px;padding-right:16px}.main{margin-left:210px}.content{padding:30px 28px}.topbar{padding:0 28px}.dashboard-grid{grid-template-columns:1fr}.report-grid{grid-template-columns:repeat(2,1fr)}.entry-grid{gap:18px;grid-template-columns:1fr 1fr}.stat{padding:19px}.stat-icon{display:none}.story-copy h1{font-size:46px}.form-grid{grid-template-columns:1fr 1fr}.heading-row .button-group{flex-wrap:wrap}.profile-links{font-size:9px}}
5
+ @media(max-width:800px){.sidebar{position:static;width:100%;padding:16px 20px;display:block;border-right:0;border-bottom:1px solid var(--border)}.brand{font-size:20px}.brand-icon{width:36px;height:36px;font-size:27px}.brand-sub{font-size:7px}.nav-label,.sidebar-bottom .local-note,.profile{display:none}.sidebar nav{display:flex;gap:5px;overflow:auto;margin-top:18px}.sidebar nav a{font-size:11px;white-space:nowrap;padding:9px 10px}.sidebar nav a>span{display:none}.sidebar-bottom{position:absolute;right:20px;top:19px;padding:0}.profile-links{margin:0;gap:13px;font-size:10px}.main{margin:0}.topbar{height:48px;font-size:10px;padding:0 20px}.content{padding:27px 20px 40px}h1{font-size:28px}.heading-row{align-items:flex-start}.meeting-banner{padding:25px}.meeting-banner h2{font-size:24px}.meeting-banner{align-items:flex-start}.banner-action{min-width:170px}.button{font-size:12px;padding:11px 15px}.stat-grid{gap:10px}.stat strong{font-size:28px}.stat{padding:18px 14px}.stat>span:not(.stat-icon){font-size:10px;padding:0;min-height:30px}.entry-grid{grid-template-columns:1fr}.entry-compose{position:static}.stepper a{font-size:10px;gap:6px}.stepper a>span{width:22px;height:22px}.login-layout{grid-template-columns:1fr}.login-story{padding:25px 30px;min-height:130px}.story-copy{padding:28px 0 0}.story-copy h1{font-size:38px}.story-copy p,.story-steps,.story-footer,.story-copy .eyebrow{display:none}.login-panel{padding:35px 25px 50px}.login-form{max-width:450px}.login-form h2{font-size:24px}.review-summary{gap:12px;font-size:10px}.card{padding:21px}.report-meta{gap:15px}.heading-row .button-group{flex-direction:column}.report-meta strong{font-size:12px}.notice{font-size:11px}}
6
+ @media(max-width:520px){.meeting-banner{display:block}.banner-action{margin-top:24px;text-align:left;max-width:260px}.banner-action small{display:none}.report-grid{grid-template-columns:1fr}.page-heading.heading-row{flex-wrap:wrap}.page-heading.heading-row>.button-group{flex-direction:row}.stat-grid{gap:8px}.stat{padding:16px 11px}.stat>span:not(.stat-icon){min-height:46px}.stat strong{font-size:27px}.stat strong small{font-size:14px}.stepper a{flex-direction:column;align-items:center;padding-bottom:15px}.stepper a>span{margin-bottom:3px}.flow-footer{gap:12px}.flow-footer>.small{max-width:110px;font-size:10px}.form-grid{grid-template-columns:1fr}.report-meta{grid-template-columns:1fr}.person-heading{flex-wrap:wrap}.person-heading h3{font-size:13px}.person-section .report-list{padding-left:22px}.review-row{display:block}.review-row p{margin-top:8px}.review-summary{flex-wrap:wrap}.login-form .eyebrow{margin-bottom:9px}.sidebar nav a{padding:8px}.topbar .today{display:none}}
7
+ @media print{body{background:#fff;font-size:11px}.sidebar,.topbar,.button,.button-group,.flash,.notice a{display:none!important}.main{margin:0}.content{padding:0;max-width:none}.card{border:0;padding:0}.person-section,tr{break-inside:avoid}.table-scroll{overflow:visible}h1{font-size:24px}.page-heading{margin-bottom:16px}.report-list{font-size:11px}.pill{border:1px solid #ddd}.report-meta{padding:12px 0}.notice{background:#fff;padding:8px 0}.wide-cell{min-width:0}th,td{padding:8px}.report-meta{grid-template-columns:repeat(3,1fr)}a{color:inherit}}
8
+
9
+ .rotation-card{margin-bottom:24px}.rotation-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:5px 22px}.rotation-grid input{max-width:100px}hr{border:0;border-top:1px solid var(--border);margin:28px 0}
10
+
11
+ .delegate-card{padding:18px;border:1px solid var(--border);border-radius:10px;background:var(--paper)}.delegate-card p{margin:7px 0 16px}
templates/admin.html ADDED
@@ -0,0 +1 @@
 
 
1
+ {% extends 'base.html' %}{% block content %}<div class="page-heading heading-row"><div><span class="eyebrow">ADMINISTRATOR</span><h1>Manage your workspace</h1><p>Start the next meeting and manage access for your fixed team.</p></div><a class="button secondary" href="{{ url_for('backup') }}">Download database backup ↓</a></div>{% include 'rotation.html' %}<section class="card"><div class="section-heading"><h2>Start the next meeting</h2><span class="pill">Current: {{ meeting.meeting_date|datefmt }}</span></div><p class="muted">Opening a new meeting closes the current one and carries forward unfinished actions. Saved drafts remain in the old report, labelled as drafts.</p><form method="post" data-confirm="Close the current meeting and open the next one? Make sure the team has finished entering their updates."><input type="hidden" name="csrf_token" value="{{ csrf_token() }}"><input type="hidden" name="operation" value="meeting"><div class="form-grid"><div><label for="meeting_date">Meeting date (Monday)</label><input id="meeting_date" type="date" name="meeting_date" required min="{{ meeting.meeting_date }}"></div><div><label for="title">Subject</label><input id="title" name="title" value="Weekly Technical Meeting" required maxlength="150"></div><div><label for="location">Location</label><input id="location" name="location" value="{{ meeting.location }}" required maxlength="150"></div><div><label for="presenter">Presented by</label><input id="presenter" name="presenter" maxlength="100"></div><div><label for="minutes_by">Minutes taken by</label><input id="minutes_by" name="minutes_by" maxlength="100"></div></div><button class="button">Open next meeting →</button></form></section><section class="card spaced"><div class="section-heading"><h2>Team accounts</h2><span class="count">{{ users|length }}</span></div><p class="muted">Password resets use the initial password and require a change at the next login. Resetting or disabling an account signs that person out.</p><div class="table-scroll"><table><thead><tr><th>Team member</th><th>Username</th><th>Access</th><th>Password</th><th>Manage</th></tr></thead><tbody>{% for user in users %}<tr><td><strong>{{ user.name }}</strong>{{ ' (you)' if user.id==g.user.id }}</td><td>{{ user.username }}</td><td><span class="pill {{ 'green' if user.active }}">{{ 'Active' if user.active else 'Disabled' }}</span></td><td>{{ 'Change required' if user.must_change else 'Personal password set' }}</td><td>{% if user.id!=g.user.id %}<div class="admin-actions"><form method="post" data-confirm="Reset this user’s password to the default password?"><input type="hidden" name="csrf_token" value="{{ csrf_token() }}"><input type="hidden" name="operation" value="reset"><input type="hidden" name="user_id" value="{{ user.id }}"><button class="link">Reset password</button></form><form method="post" data-confirm="Change this user’s access?"><input type="hidden" name="csrf_token" value="{{ csrf_token() }}"><input type="hidden" name="operation" value="toggle"><input type="hidden" name="user_id" value="{{ user.id }}"><button class="link {{ 'danger' if user.active }}">{{ 'Disable' if user.active else 'Enable' }}</button></form></div>{% else %}<a href="{{ url_for('password') }}">Change password</a>{% endif %}</td></tr>{% endfor %}</tbody></table></div></section><p class="small muted">Backups include account records and meeting data. Keep them in a private folder. Restore instructions are in README.md.</p>{% endblock %}
templates/base.html ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>{% block title %}MOM · Meeting workspace{% endblock %}</title><link rel="stylesheet" href="{{ url_for('static',filename='style.css') }}"><script src="{{ url_for('static',filename='app.js') }}" defer></script></head>
4
+ <body class="{% if not g.user %}auth-body{% endif %}">
5
+ {% if g.user %}
6
+ <aside class="sidebar"><a class="brand" href="{{ url_for('dashboard') }}"><span class="brand-icon">m.</span><span>MOM<span class="brand-sub">TEAM WORKSPACE</span></span></a><div class="nav-label">WORKSPACE</div><nav><a class="{{ 'selected' if request.endpoint=='dashboard' }}" href="{{ url_for('dashboard') }}"><span>◫</span> Overview</a><a class="{{ 'selected' if request.endpoint=='workflow' }}" href="{{ url_for('workflow',step=1) }}"><span>+</span> My meeting entry</a><a class="{{ 'selected' if request.endpoint in ['reports','report'] }}" href="{{ url_for('reports') }}"><span>▤</span> Meeting reports</a>{% if can_coordinate %}<a class="{{ 'selected' if request.endpoint=='coordinator' }}" href="{{ url_for('coordinator') }}"><span>◎</span> Coordinate meeting</a>{% endif %}{% if g.user.is_admin %}<a class="{{ 'selected' if request.endpoint=='admin' }}" href="{{ url_for('admin') }}"><span>⚙</span> Administration</a>{% endif %}</nav><div class="sidebar-bottom"><div class="local-note"><span class="dot"></span> Stored on this computer</div><div class="profile"><span class="avatar">{{ g.user.name[0] }}</span><div><strong>{{ g.user.name }}</strong><small>{{ 'Administrator' if g.user.is_admin else 'Team member' }}</small></div></div><div class="profile-links"><a href="{{ url_for('password') }}">Change password</a><form method="post" action="{{ url_for('logout') }}"><input type="hidden" name="csrf_token" value="{{ csrf_token() }}"><button class="link">Sign out</button></form></div></div></aside>
7
+ {% endif %}
8
+ <main class="{% if g.user %}main{% else %}auth-main{% endif %}">{% if g.user %}<header class="topbar"><span>Technical team <span class="muted">/</span> Meeting workspace</span><span class="today">{{ today|datefmt }}</span></header>{% endif %}<div class="{% if g.user %}content{% endif %}">{% with messages=get_flashed_messages(with_categories=true) %}{% for category,message in messages %}<div class="flash {{ category }}" role="status">{{ message }}</div>{% endfor %}{% endwith %}{% block content %}{% endblock %}</div></main></body></html>
templates/coordinator.html ADDED
@@ -0,0 +1 @@
 
 
1
+ {% extends 'base.html' %}{% block content %}<div class="page-heading heading-row"><div><span class="eyebrow">THIS WEEK’S REPORT COORDINATOR</span><h1>Bring the weekly report together.</h1><p>{{ meeting.meeting_date|datefmt }} · {{ meeting.minutes_by }}</p></div><a class="button" href="{{ url_for('report',mid=meeting.id) }}">Review full report →</a></div><section class="card"><div class="section-heading"><h2>Team submission progress</h2><span class="count">{{ users|selectattr('submitted_at')|list|length }} / {{ users|length }}</span></div><div class="table-scroll"><table><thead><tr><th>Team member</th><th>Updates</th><th>New actions</th><th>Entry status</th></tr></thead><tbody>{% for user in users %}<tr><td>{{ user.name }}</td><td>{{ updates|selectattr('user_id','equalto',user.id)|list|length }}</td><td>{{ actions|selectattr('user_id','equalto',user.id)|list|length }}</td><td><span class="pill {{ 'green' if user.submitted_at else 'amber' }}">{{ 'Submitted' if user.submitted_at else ('Draft' if user.reviewed else 'Not started') }}</span></td></tr>{% endfor %}</tbody></table></div></section>{% include 'coordinator_people.html' %}{% include 'preparation_date.html' %}<section class="card spaced"><h2>Meeting details</h2><form method="post"><input type="hidden" name="csrf_token" value="{{ csrf_token() }}"><input type="hidden" name="meeting_id" value="{{ meeting.id }}"><input type="hidden" name="operation" value="details"><div class="form-grid"><div><label for="title">Subject</label><input id="title" name="title" value="{{ meeting.title }}" required maxlength="150"></div><div><label for="location">Location</label><input id="location" name="location" value="{{ meeting.location }}" required maxlength="150"></div><div><label for="presenter">Presented by</label><input id="presenter" name="presenter" value="{{ meeting.presenter }}" maxlength="100"></div></div><button class="button">Save meeting details</button></form></section><section class="card spaced"><h2>Pass it to the next coordinator</h2><p class="muted">Next meeting: <strong>{{ next_date|datefmt }}</strong><br>Next report coordinator: <strong>{{ next_owner.name }}</strong></p><p class="muted">When this report is ready, close the meeting and open next Monday’s entry. Unfinished actions carry forward. Saved drafts remain in this report with their submission status.</p><form method="post" data-confirm="Close this meeting and pass the report coordinator role to the next member? Check team submissions first."><input type="hidden" name="csrf_token" value="{{ csrf_token() }}"><input type="hidden" name="meeting_id" value="{{ meeting.id }}"><input type="hidden" name="operation" value="next"><button class="button">Finish meeting & open next Monday →</button></form></section>{% endblock %}
templates/coordinator_people.html ADDED
@@ -0,0 +1 @@
 
 
1
+ <section class="card spaced"><h2>Entries you’re preparing for others</h2><p class="muted">For people outside the seven-member rotation, review their actions and enter their updates and new actions here. Their names stay attached to their work.</p><div class="report-grid">{% for user in users if user.rotation_order is none %}<div class="delegate-card"><h3>{{ user.name }}</h3><p class="small muted">{{ 'Submitted' if user.submitted_at else 'Awaiting coordinator entry' }}</p>{% if user.submitted_at %}<form method="post" action="{{ url_for('reopen',person=user.id) }}"><input type="hidden" name="csrf_token" value="{{ csrf_token() }}"><input type="hidden" name="meeting_id" value="{{ meeting.id }}"><button class="button secondary small-button">Edit entry →</button></form>{% else %}<a class="button secondary small-button" href="{{ url_for('workflow',step=1,person=user.id) }}">Prepare entry →</a>{% endif %}</div>{% endfor %}</div></section>
templates/dashboard.html ADDED
@@ -0,0 +1 @@
 
 
1
+ {% extends 'base.html' %}{% block content %}<div class="page-heading heading-row"><div><span class="eyebrow">YOUR MEETING WORKSPACE</span><h1>Hello, {{ g.user.name.split()[0] }}.</h1><p>A little preparation makes a better meeting.</p></div><span class="pill"><span class="dot"></span> Meeting open</span></div><section class="meeting-banner"><div><div class="eyebrow">CURRENT MEETING · {{ meeting.meeting_date|datefmt }}</div><h2>{{ meeting.title }}</h2><p>{{ meeting.location }} · Monday meeting<br>Report coordinator: {{ coordinator.name if coordinator else meeting.minutes_by }}</p><div class="banner-note">{{ team }} of {{ total }} team members have submitted their entries.</div></div><div class="banner-action">{% if g.user.rotation_order is none %}<a class="button light" href="{{ url_for('report',mid=meeting.id) }}">View team report →</a><small>The weekly coordinator prepares your entry.</small>{% else %}{% if sub and sub.submitted_at %}<span class="pill green">✓ Entry submitted</span><form method="post" action="{{ url_for('reopen') }}"><input type="hidden" name="csrf_token" value="{{ csrf_token() }}"><input type="hidden" name="meeting_id" value="{{ meeting.id }}"><button class="button light">Edit submission →</button></form>{% else %}<a class="button light" href="{{ url_for('workflow',step=1) }}">{{ 'Continue my entry' if sub else 'Prepare my entry' }} <span>→</span></a><small>Each item is saved as you add it.</small>{% endif %}{% endif %}</div></section><div class="stat-grid"><div class="stat"><span class="stat-icon">☑</span><span>Previous actions completed</span><strong>{{ stats.completed }} <small>/ {{ stats.total }}</small></strong></div><div class="stat"><span class="stat-icon">▤</span><span>Updates added</span><strong>{{ stats.updates }}</strong></div><div class="stat"><span class="stat-icon">↗</span><span>New actions planned</span><strong>{{ stats.actions }}</strong></div></div><div class="dashboard-grid"><section class="card"><div class="section-heading"><h2>Your next steps</h2><span class="muted small">ONE AT A TIME</span></div><div class="guide-row"><span class="step-number">1</span><div><h3>Review previous actions</h3><p>Tick the work you’ve completed. Unfinished items carry forward.</p></div></div><div class="guide-row"><span class="step-number">2</span><div><h3>Share your updates</h3><p>Add as many updates as you need, one item at a time.</p></div></div><div class="guide-row"><span class="step-number">3</span><div><h3>Set your next actions</h3><p>Add a clear action and its due date, then submit your entry.</p></div></div></section><section class="card"><div class="section-heading"><h2>Recent meetings</h2><a href="{{ url_for('reports') }}">View all →</a></div>{% for item in recent %}<a class="recent-row" href="{{ url_for('report',mid=item.id) }}"><span class="calendar-icon">{{ item.meeting_date[8:] }}</span><div><strong>{{ item.meeting_date|datefmt }}</strong><small>{{ item.title }}</small></div><span>↗</span></a>{% endfor %}<p class="small muted source-note">The 21 September meeting supplies the starting action checklist. The report coordinator rotates each Monday.</p></section></div>{% endblock %}
templates/error.html ADDED
@@ -0,0 +1 @@
 
 
1
+ {% extends 'base.html' %}{% block content %}<section class="card error-card"><span class="eyebrow">{{ error.code }}</span><h1>{{ error.name }}</h1><p>{{ error.description }}</p><a class="button" href="{{ url_for('dashboard') if g.user else url_for('login') }}">Back to workspace</a></section>{% endblock %}
templates/login.html ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ {% extends 'base.html' %}{% block title %}Sign in · MOM{% endblock %}{% block content %}
2
+ <div class="login-layout"><section class="login-story"><a class="brand" href="{{ url_for('login') }}"><span class="brand-icon">m.</span><span>MOM<span class="brand-sub">TEAM WORKSPACE</span></span></a><div class="story-copy"><div class="eyebrow">A CLEARER WAY TO MEET</div><h1>Good meetings.<br>Clear next steps.</h1><p>Keep your team’s updates, decisions and actions together. Pick up where the last meeting left off.</p><div class="story-steps"><div><span>01</span> Review previous actions</div><div><span>02</span> Share your updates</div><div><span>03</span> Plan what comes next</div></div></div><div class="story-footer"><span class="dot"></span> Your workspace. Stored locally.</div></section><section class="login-panel"><div class="login-form"><span class="eyebrow">WELCOME BACK</span><h2>Sign in to your workspace</h2><p class="muted">Select your account to prepare your meeting entry.</p><form method="post"><input type="hidden" name="csrf_token" value="{{ csrf_token() }}"><label for="username">Team member</label><select name="username" id="username" required autofocus><option value="">Choose your name</option>{% for user in users %}<option value="{{ user.username }}" {{ 'selected' if request.form.get('username')==user.username }}>{{ user.name }}</option>{% endfor %}</select><label for="password">Password</label><div class="password-wrap"><input type="password" name="password" id="password" required autocomplete="current-password" maxlength="128"><button type="button" class="show-password" data-password="password">Show</button></div><button class="button full" type="submit">Sign in <span>→</span></button></form><div class="help-box"><strong>First time here?</strong><p>Use the default password shared by your administrator. You’ll choose a new password after signing in.</p></div><p class="small muted">Need help with access? Contact Kishan H M.</p></div></section></div>
3
+ {% endblock %}
templates/password.html ADDED
@@ -0,0 +1 @@
 
 
1
+ {% extends 'base.html' %}{% block title %}Change password · MOM{% endblock %}{% block content %}<div class="page-heading"><span class="eyebrow">ACCOUNT SECURITY</span><h1>{{ 'Choose your own password' if g.user.must_change else 'Change your password' }}</h1><p>{{ 'Before your first meeting entry, replace the default password.' if g.user.must_change else 'Keep your account accessible only to you.' }}</p></div><section class="card narrow"><form method="post"><input type="hidden" name="csrf_token" value="{{ csrf_token() }}"><label for="current">Current password</label><input id="current" name="current_password" type="password" autocomplete="current-password" required maxlength="128"><label for="new">New password</label><input id="new" name="new_password" type="password" autocomplete="new-password" required minlength="10" maxlength="128"><p class="field-hint">10–128 characters, including uppercase, lowercase, a number and a symbol.</p><label for="confirm">Confirm new password</label><input id="confirm" name="confirm_password" type="password" autocomplete="new-password" required minlength="10" maxlength="128"><button class="button">Save password & continue →</button></form></section>{% endblock %}
templates/preparation_date.html ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <section class="card spaced">
2
+ <h2>Report preparation date</h2>
3
+ <p class="muted">Choose the working day when you prepare this report after the {{ meeting.meeting_date|datefmt }} meeting, before the following Monday.</p>
4
+ <form method="post">
5
+ <input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
6
+ <input type="hidden" name="meeting_id" value="{{ meeting.id }}">
7
+ <input type="hidden" name="operation" value="preparation_date">
8
+ <label for="prepared_on">Prepared on</label>
9
+ <select id="prepared_on" name="prepared_on" required>
10
+ <option value="">Choose a working day</option>
11
+ {% for day in preparation_days %}<option value="{{ day.isoformat() }}" {{ 'selected' if day.isoformat()==meeting.prepared_on }}>{{ day.strftime('%A, %d %B %Y') }}</option>{% endfor %}
12
+ </select>
13
+ <button class="button">Save preparation date</button>
14
+ </form>
15
+ </section>
templates/report.html ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ {% extends 'base.html' %}{% block title %}{{ meeting.meeting_date|datefmt }} · MOM report{% endblock %}{% block content %}<div class="page-heading heading-row"><div><span class="eyebrow">MINUTES OF THE MEETING</span><h1>{{ meeting.title }}</h1><p>{{ meeting.meeting_date|datefmt }} · {{ meeting.location }}</p></div><div class="button-group"><button class="button secondary" id="print-report">Print</button><a class="button" href="{{ url_for('excel',mid=meeting.id) }}">Download Excel ↓</a></div></div><section class="report-meta"><div><span>Report prepared on</span><strong>{{ meeting.prepared_on|datefmt if meeting.prepared_on else "Not selected" }}</strong></div><div><span>Presented by</span><strong>{{ meeting.presenter or 'Not specified' }}</strong></div><div><span>Minutes taken by</span><strong>{{ meeting.minutes_by or 'Team contributions' }}</strong></div><div><span>Meeting status</span><strong>{{ 'Open for entries' if meeting.status=='active' else 'Closed' }}</strong></div></section>{% if meeting.source_file %}<div class="notice">Imported from {{ source_label }}. Original completion status was not recorded. The meeting date and report preparer reflect your corrections; dates inside the original file are unchanged. <a href="{{ url_for('original',mid=meeting.id) }}">Download original workbook ↗</a></div>{% else %}<div class="notice">Excel downloads copy the previous workbook. Only this week’s updates and new actions appear in MOM. Completed previous actions are appended to CLOSED; unfinished actions remain in app history. Saved drafts are included.</div>{% endif %}<section class="card"><div class="section-heading"><h2>Team updates</h2><span class="count">{{ updates|length }}</span></div>{% for user in users %}{% set own=updates|selectattr('user_id','equalto',user.id)|list %}<div class="person-section"><div class="person-heading"><span class="avatar">{{ user.name[0] }}</span><h3>{{ user.name }}</h3><span class="pill {{ 'green' if user.submitted_at else '' }}">{{ ('Imported' if meeting.source_file else 'Submitted') if user.submitted_at else ('Draft' if own or user.reviewed else 'No entry') }}</span></div><ol class="report-list">{% for item in own %}<li>{{ item.body }}</li>{% else %}<p class="muted small">No updates recorded.</p>{% endfor %}</ol></div>{% endfor %}</section>
2
+ {% if reviews %}<section class="card spaced"><div class="section-heading"><h2>Previous action history (app only)</h2><span class="count">{{ reviews|length }}</span></div><div class="table-scroll"><table><thead><tr><th>Action</th><th>Owner</th><th>Due date</th><th>Status</th></tr></thead><tbody>{% for a in reviews %}<tr><td class="wide-cell">{{ a.body }}<small>From {{ a.source_date|datefmt }}</small></td><td>{{ a.name }}</td><td>{{ a.due_date|datefmt if a.due_date else (a.due_note or 'Not recorded') }}</td><td><span class="pill {{ 'green' if a.checked else 'amber' }}">{{ 'Completed' if a.checked else 'Open' }}</span></td></tr>{% endfor %}</tbody></table></div></section>{% endif %}
3
+ <section class="card spaced"><div class="section-heading"><h2>Actions from this meeting</h2><span class="count">{{ actions|length }}</span></div><div class="table-scroll"><table><thead><tr><th>#</th><th>Action</th><th>Due date</th><th>Owner</th></tr></thead><tbody>{% for a in actions %}<tr><td>{{ loop.index }}</td><td class="wide-cell">{{ a.body }}</td><td>{{ a.due_date|datefmt if a.due_date else (a.due_note or 'Not recorded') }}</td><td>{{ a.name }}</td></tr>{% else %}<tr><td colspan="4" class="muted">No new actions recorded.</td></tr>{% endfor %}</tbody></table></div></section><p class="small muted">Later completion changes are recorded in subsequent meetings, keeping this meeting’s history intact.</p>{% endblock %}
templates/reports.html ADDED
@@ -0,0 +1 @@
 
 
1
+ {% extends 'base.html' %}{% block content %}<div class="page-heading"><span class="eyebrow">THE TEAM’S RECORD</span><h1>Meeting reports</h1><p>Every update and action, organised by meeting date.</p></div><div class="report-grid">{% for m in meetings %}<section class="card report-card"><div class="section-heading"><span class="pill {{ 'green' if m.status=='active' }}">{{ 'Current meeting' if m.status=='active' else ('Imported report' if m.source_file else 'Closed meeting') }}</span><span class="muted">↗</span></div><h2>{{ m.meeting_date|datefmt }}</h2><p>{{ m.title }}</p><p class="small muted">{{ m.location }}</p><div class="report-counts"><span><strong>{{ m.update_count }}</strong> updates</span><span><strong>{{ m.action_count }}</strong> new actions</span></div><a class="button secondary full" href="{{ url_for('report',mid=m.id) }}">Open report →</a></section>{% endfor %}</div>{% endblock %}
templates/rotation.html ADDED
@@ -0,0 +1 @@
 
 
1
+ <section class="card rotation-card"><div class="section-heading"><h2>Weekly coordinator rotation</h2><span class="pill">Every Monday</span></div><p class="muted">Kishan prepared the 21 September report. The next member in this order prepares the next report. Leave a position blank to exclude a person from rotation; their login still works.</p><form method="post"><input type="hidden" name="csrf_token" value="{{ csrf_token() }}"><input type="hidden" name="operation" value="rotation"><div class="rotation-grid">{% for user in users %}<div><label for="order-{{ user.id }}">{{ user.name }}</label><input type="number" id="order-{{ user.id }}" name="order_{{ user.id }}" min="1" max="100" value="{{ user.rotation_order if user.rotation_order is not none else '' }}"></div>{% endfor %}</div><button class="button">Save rotation order</button></form><hr><form method="post"><input type="hidden" name="csrf_token" value="{{ csrf_token() }}"><input type="hidden" name="operation" value="assign"><label for="coordinator_id">Coordinator for {{ meeting.meeting_date|datefmt }}</label><select id="coordinator_id" name="coordinator_id" required>{% for user in users if user.active %}<option value="{{ user.id }}" {{ 'selected' if user.id==meeting.coordinator_id }}>{{ user.name }}</option>{% endfor %}</select><button class="button secondary">Update current coordinator</button></form></section>
templates/setup.html ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ {% extends 'base.html' %}{% block content %}<div class="page-heading"><span class="eyebrow">FIRST-RUN SETUP</span><h1>Start with your previous MOM.</h1><p>Import the old Excel report so each person can review their unfinished actions.</p></div><section class="card"><h2>1. Upload the previous report</h2><p class="muted">Use the first sheet’s Actions, Due Date and Owner columns, as in your sample reports. You’ll review the names and actions before importing.</p><form method="post" enctype="multipart/form-data"><input type="hidden" name="csrf_token" value="{{ csrf_token() }}"><input type="hidden" name="operation" value="upload"><label for="report">Previous MOM workbook (.xlsx, up to 10 MB)</label><input type="file" id="report" name="report" accept=".xlsx" required><button class="button">Read report & preview →</button></form></section>
2
+ {% if preview %}<section class="card spaced"><div class="section-heading"><h2>2. Review your import</h2><span class="pill">{{ preview.actions|length }} actions · {{ preview.updates|length }} updates</span></div><p class="muted">{{ preview.filename }}. Text deadlines are kept as notes. Actions already marked completed in an app export are excluded from the new checklist.</p><form method="post"><input type="hidden" name="csrf_token" value="{{ csrf_token() }}"><input type="hidden" name="operation" value="confirm"><div class="form-grid"><div><label for="report_date">Actual date of the old meeting</label><input type="date" id="report_date" name="report_date" value="{{ request.form.get('report_date','2026-09-21') }}" required><p class="field-hint">Use the actual Monday, even if the filename has an older date.</p></div><div><label for="meeting_date">Upcoming meeting (Monday)</label><input type="date" id="meeting_date" name="meeting_date" value="{{ request.form.get('meeting_date',meeting.meeting_date) }}" required></div><div><label for="coordinator">Upcoming report coordinator</label><select id="coordinator" name="coordinator_id">{% for user in users if user.active and user.rotation_order %}<option value="{{ user.id }}" {{ 'selected' if user.id==meeting.coordinator_id }}>{{ user.name }}</option>{% endfor %}</select></div></div><h3 class="spaced">Match the names in the report</h3><div class="form-grid">{% for name in preview.owners %}<div><label for="owner-{{ loop.index0 }}">{{ name }}</label><select id="owner-{{ loop.index0 }}" name="owner_{{ loop.index0 }}" required><option value="">Choose a person</option>{% for user in users %}<option value="{{ user.id }}" {{ 'selected' if mapping[name]==user.id }}>{{ user.name }}</option>{% endfor %}<option value="new" {{ 'selected' if not mapping[name] }}>New participant — handled by coordinator</option></select></div>{% endfor %}</div><div class="table-scroll spaced"><table><thead><tr><th>Action</th><th>Owner in report</th><th>Due date / note</th><th>Status</th></tr></thead><tbody>{% for a in preview.actions %}<tr><td class="wide-cell">{{ a.body }}</td><td>{{ a.owner }}</td><td>{{ a.due_date|datefmt if a.due_date else a.due_note }}</td><td>{{ 'Completed' if a.completed else 'To review' }}</td></tr>{% endfor %}</tbody></table></div><p class="field-hint">This becomes the starting checklist. Supplied sample history for the same date is replaced. The original uploaded file is kept locally.</p><button class="button">Confirm import & open workspace →</button></form></section>{% endif %}
3
+ <section class="card spaced"><h2>Or use the report you already supplied</h2><p class="muted">Start with 40 actions from your 21 September report (the file is named 15-09-2026). August stays available as history.</p><form method="post"><input type="hidden" name="csrf_token" value="{{ csrf_token() }}"><input type="hidden" name="operation" value="sample"><div class="form-grid"><div><label for="sample_date">Upcoming meeting (Monday)</label><input type="date" id="sample_date" name="meeting_date" value="{{ meeting.meeting_date }}" required></div><div><label for="sample_coordinator">Report coordinator</label><select id="sample_coordinator" name="coordinator_id">{% for user in users if user.active and user.rotation_order %}<option value="{{ user.id }}" {{ 'selected' if user.id==meeting.coordinator_id }}>{{ user.name }}</option>{% endfor %}</select></div></div><button class="button secondary">Use supplied report & open workspace →</button></form></section>{% endblock %}
templates/setup_waiting.html ADDED
@@ -0,0 +1 @@
 
 
1
+ {% extends 'base.html' %}{% block content %}<section class="card narrow"><span class="eyebrow">WORKSPACE SETUP</span><h1>The team’s starting report is being set up.</h1><p class="muted">Kishan needs to upload or select the previous MOM report first. Your action checklist will then be ready.</p><a href="{{ url_for('dashboard') }}" class="button">Check again</a></section>{% endblock %}
templates/workflow.html ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ {% extends 'base.html' %}{% block title %}My meeting entry · MOM{% endblock %}{% block content %}
2
+ {% macro hidden() %}<input type="hidden" name="csrf_token" value="{{ csrf_token() }}"><input type="hidden" name="meeting_id" value="{{ meeting.id }}">{% endmacro %}
3
+ <div class="page-heading heading-row"><div><span class="eyebrow">{{ meeting.meeting_date|datefmt }} · ENTRY FOR {{ entry_user.name|upper }}</span><h1>{{ ['Review previous actions','Share your updates','Plan your next actions','Review & submit'][step-1] }}</h1><p>{{ ['Tick completed actions. Leave unfinished actions unchecked.','Add one update at a time. There’s no limit to how many you can add.','Give each action a description and a due date.','Check your saved items before submitting this meeting entry.'][step-1] }}</p></div><a class="text-link" href="{{ url_for('dashboard') }}">Exit to overview ↗</a></div>
4
+ {% if entry_user.id!=g.user.id %}<div class="notice">You’re preparing this entry for <strong>{{ entry_user.name }}</strong>. It will appear under their name in the report. <a href="{{ url_for('coordinator') }}">Back to coordinator desk</a></div>{% endif %}<nav class="stepper" aria-label="Meeting entry steps">{% for label in ['Previous actions','Updates','New actions','Review'] %}<a href="{{ flow_url(loop.index) }}" class="{{ 'current' if step==loop.index else ('done' if step>loop.index else '') }}" {% if step==loop.index %}aria-current="step"{% endif %}><span>{{ loop.index }}</span>{{ label }}</a>{% endfor %}</nav>
5
+ {% if step==1 %}<form method="post" data-dirty>{{ hidden() }}<section class="card"><div class="section-heading"><h2>Actions to follow up</h2><span class="count">{{ previous|length }}</span></div>{% for action in previous %}<label class="check-row" for="action-{{ action.id }}"><input id="action-{{ action.id }}" type="checkbox" name="completed" value="{{ action.id }}" {{ 'checked' if action.checked }}><span class="check-content"><strong>{{ action.body }}</strong><span class="item-meta">{% if action.due_date %}<span class="{{ 'overdue' if action.due_date<today and not action.checked }}">Due {{ action.due_date|datefmt }}</span>{% else %}{{ action.due_note or 'No date recorded' }}{% endif %}<span>From {{ action.source_date|datefmt }}</span></span></span></label>{% else %}<div class="empty"><span>✓</span><h3>No previous actions to review</h3><p>You can move on to your updates.</p></div>{% endfor %}</section><div class="flow-footer"><span class="muted small">Changes save when you continue.</span><button class="button">Save & continue →</button></div></form>
6
+ {% elif step in [2,3] %}<div class="entry-grid"><section class="card entry-compose"><div class="section-heading"><h2>{{ 'Add an update' if step==2 else 'Add an action' }}</h2><span class="count">+</span></div><form method="post" data-dirty>{{ hidden() }}<input type="hidden" name="entry_token" value="{{ token() }}"><input type="hidden" name="operation" value="add"><label for="body">{{ 'What have you worked on?' if step==2 else 'What needs to be done?' }}</label><textarea name="body" id="body" rows="6" maxlength="3000" required placeholder="{{ 'For example: Finished testing the new attendance module.' if step==2 else 'For example: Complete the API integration for leave management.' }}">{{ request.form.get('body','') if request.method=='POST' and request.form.get('operation')=='add' else '' }}</textarea><div class="field-hint char-counter" data-for="body">One clear item per entry.</div>{% if step==3 %}<label for="due_date">Due date</label><input id="due_date" name="due_date" type="date" min="{{ action_min }}" max="{{ action_max }}" value="{{ request.form.get('due_date','') }}" required>{% endif %}<button class="button full">+ Save {{ 'update' if step==2 else 'action' }}</button></form><p class="small muted">After saving, this form is ready for your next item.</p></section><section class="card"><div class="section-heading"><h2>{{ 'Your updates' if step==2 else 'Your new actions' }}</h2><span class="count">{{ updates|length if step==2 else actions|length }}</span></div>{% for item in (updates if step==2 else actions) %}<article class="entry-item"><div class="item-number">{{ '%02d'|format(loop.index) }}</div><div class="entry-text"><p>{{ item.body }}</p>{% if step==3 %}<div class="item-meta">Due {{ item.due_date|datefmt }}</div>{% endif %}<details><summary>Edit item</summary><form method="post" data-dirty>{{ hidden() }}<input type="hidden" name="operation" value="edit"><input type="hidden" name="item_id" value="{{ item.id }}"><label for="edit-{{ item.id }}">Description</label><textarea id="edit-{{ item.id }}" name="body" maxlength="3000" required rows="4">{{ item.body }}</textarea>{% if step==3 %}<label for="date-{{ item.id }}">Due date</label><input id="date-{{ item.id }}" type="date" name="due_date" min="{{ action_min }}" max="{{ action_max }}" value="{{ item.due_date }}" required>{% endif %}<button class="button small-button">Save changes</button></form></details><form method="post" class="delete-form" data-confirm="Remove this saved item?">{{ hidden() }}<input type="hidden" name="operation" value="delete"><input type="hidden" name="item_id" value="{{ item.id }}"><button class="link danger">Remove</button></form></div></article>{% else %}<div class="empty"><span>+</span><h3>{{ 'Your updates start here' if step==2 else 'Make room for what’s next' }}</h3><p>Saved {{ 'updates' if step==2 else 'actions' }} will appear in this list.</p></div>{% endfor %}</section></div><div class="flow-footer"><a class="button secondary" href="{{ flow_url(step-1) }}">← Back</a><form method="post">{{ hidden() }}<input type="hidden" name="operation" value="next"><button class="button">{{ 'Continue to actions' if step==2 else 'Review my entry' }} →</button></form></div>
7
+ {% else %}<div class="review-summary"><span>{{ previous|selectattr('checked')|list|length }} / {{ previous|length }} previous actions completed</span><span>{{ updates|length }} updates</span><span>{{ actions|length }} new actions</span></div><section class="card"><div class="section-heading"><h2>Previous actions</h2><a href="{{ flow_url(1) }}">Edit</a></div>{% for a in previous %}<div class="review-row"><span class="pill {{ 'green' if a.checked else 'amber' }}">{{ 'Completed' if a.checked else 'Open' }}</span><p>{{ a.body }}</p></div>{% else %}<p class="muted">No previous actions.</p>{% endfor %}</section><section class="card spaced"><div class="section-heading"><h2>Updates</h2><a href="{{ flow_url(2) }}">Edit</a></div><ol class="report-list">{% for item in updates %}<li>{{ item.body }}</li>{% else %}<p class="muted">No updates added for this meeting.</p>{% endfor %}</ol></section><section class="card spaced"><div class="section-heading"><h2>New actions</h2><a href="{{ flow_url(3) }}">Edit</a></div>{% for a in actions %}<div class="review-row"><span class="pill">{{ a.due_date|datefmt }}</span><p>{{ a.body }}</p></div>{% else %}<p class="muted">No new actions added for this meeting.</p>{% endfor %}</section><div class="flow-footer"><a class="button secondary" href="{{ flow_url(3) }}">← Back</a><form method="post">{{ hidden() }}<button class="button">Submit meeting entry ✓</button></form></div>{% endif %}
8
+ {% endblock %}
tests/__init__.py ADDED
File without changes
tests/conftest.py ADDED
@@ -0,0 +1 @@
 
 
1
+ from tests.test_app import seeded,app,client
tests/test_app.py ADDED
@@ -0,0 +1,213 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from datetime import date, timedelta
2
+ from io import BytesIO
3
+ from pathlib import Path
4
+ import shutil
5
+ import sqlite3
6
+ import secrets
7
+ import pytest
8
+ from openpyxl import load_workbook
9
+ from werkzeug.security import check_password_hash
10
+ from app import create_app
11
+
12
+ PASSWORD='MyTestPassword@456'
13
+
14
+ @pytest.fixture(scope='session')
15
+ def seeded(tmp_path_factory):
16
+ path=tmp_path_factory.mktemp('seed')/'base.sqlite3'
17
+ create_app({'TESTING':True,'DATABASE':str(path),'SECRET_KEY':'test-secret'})
18
+ return path
19
+
20
+ @pytest.fixture
21
+ def app(tmp_path,seeded):
22
+ path=tmp_path/'mom.sqlite3'
23
+ shutil.copy2(seeded,path)
24
+ return create_app({'TESTING':True,'DATABASE':str(path),'SECRET_KEY':'test-secret','REQUIRE_SETUP':False})
25
+
26
+ @pytest.fixture
27
+ def client(app):
28
+ return app.test_client()
29
+
30
+ def query(app,sql,args=()):
31
+ with sqlite3.connect(app.config['DATABASE']) as db:
32
+ db.row_factory=sqlite3.Row
33
+ return db.execute(sql,args).fetchall()
34
+
35
+ def csrf(client):
36
+ with client.session_transaction() as session:
37
+ return session['csrf']
38
+
39
+ def post(client,path,data=None):
40
+ return client.post(path,data={'csrf_token':csrf(client),**(data or {})})
41
+
42
+ def login(client,name='kishan',change=True):
43
+ client.get('/login')
44
+ result=post(client,'/login',{'username':name,'password':'Password@123'})
45
+ assert result.status_code==302
46
+ client.get('/password')
47
+ if change:
48
+ result=post(client,'/password',{'current_password':'Password@123','new_password':PASSWORD,'confirm_password':PASSWORD})
49
+ assert result.status_code==302
50
+ client.get('/')
51
+ return result
52
+
53
+ def active(app):
54
+ return query(app,"SELECT * FROM meetings WHERE status='active'")[0]
55
+
56
+ def review(client,app,completed=None):
57
+ return post(client,'/entry/1',{'meeting_id':active(app)['id'],'completed':completed or []})
58
+
59
+ def add(client,app,step,body='Saved test item',**kwargs):
60
+ return post(client,f'/entry/{step}',{'meeting_id':active(app)['id'],'entry_token':secrets.token_hex(20),'body':body,**kwargs})
61
+
62
+ def test_seed_and_rotation(app):
63
+ users=query(app,'SELECT * FROM users ORDER BY id')
64
+ assert len(users)==14
65
+ assert [u['username'] for u in users if u['rotation_order']] == ['kishan','harshitha','gokul','manish','madhan','honey','madhav']
66
+ assert all(u['must_change'] and u['password_hash']!='Password@123' for u in users)
67
+ assert check_password_hash(users[0]['password_hash'],'Password@123')
68
+ assert query(app,'SELECT COUNT(*) n FROM updates')[0]['n']==182
69
+ assert query(app,'SELECT COUNT(*) n FROM reviews')[0]['n']==40
70
+ assert date.fromisoformat(active(app)['meeting_date']).weekday()==0
71
+ assert active(app)['minutes_by']=='Harshitha P'
72
+ assert query(app,"SELECT meeting_date FROM meetings WHERE source_file LIKE '%15-09%'")[0]['meeting_date']=='2026-09-21'
73
+ assert query(app,"SELECT COUNT(*) n FROM actions WHERE due_note='Daily'")[0]['n']>0
74
+
75
+ def test_forced_password_change_and_csrf(client,app):
76
+ assert client.get('/reports').status_code==302
77
+ client.get('/login')
78
+ assert client.post('/login',data={'username':'kishan','password':'Password@123'}).status_code==400
79
+ login(client,change=False)
80
+ for path in ['/','/reports','/admin/backup','/entry/1','/coordinator']:
81
+ assert client.get(path).location.endswith('/password')
82
+ r=post(client,'/password',{'current_password':'Password@123','new_password':'Password@123','confirm_password':'Password@123'})
83
+ assert b'Choose a password different' in r.data
84
+ post(client,'/password',{'current_password':'Password@123','new_password':PASSWORD,'confirm_password':PASSWORD})
85
+ assert client.get('/').status_code==200
86
+ assert query(app,"SELECT must_change FROM users WHERE username='kishan'")[0]['must_change']==0
87
+
88
+ def test_full_workflow_validation_and_persistence(client,app):
89
+ login(client)
90
+ assert client.get('/entry/2').location.endswith('/entry/1')
91
+ previous=query(app,"SELECT a.id FROM actions a JOIN users u ON u.id=a.user_id JOIN reviews r ON a.id=r.action_id WHERE u.username='kishan'")
92
+ chosen=previous[0]['id']
93
+ assert review(client,app,[str(chosen)]).status_code==302
94
+ assert add(client,app,2,'First update').status_code==302
95
+ assert add(client,app,2,'Second update').status_code==302
96
+ assert b'Choose a due date' in add(client,app,3,due_date='').data
97
+ assert b'Choose a due date' in add(client,app,3,due_date='2020-01-01').data
98
+ due=(date.fromisoformat(active(app)['meeting_date'])+timedelta(days=2)).isoformat()
99
+ assert add(client,app,3,'New dated action',due_date=due).status_code==302
100
+ for path in ['/entry/1','/entry/2','/entry/3','/entry/4','/reports','/admin','/coordinator']:
101
+ assert client.get(path).status_code==200
102
+ mid=active(app)['id']
103
+ assert post(client,'/entry/4',{'meeting_id':mid}).status_code==302
104
+ assert add(client,app,2,'Must be blocked').status_code==409
105
+ # Restarting the application retains saved rows and the submission.
106
+ restarted=create_app({'TESTING':True,'DATABASE':app.config['DATABASE'],'SECRET_KEY':'test-secret'})
107
+ assert query(restarted,'SELECT COUNT(*) n FROM updates WHERE meeting_id=?',(mid,))[0]['n']==2
108
+ assert query(restarted,'SELECT completed FROM actions WHERE id=?',(chosen,))[0]['completed']==1
109
+ assert post(client,'/reopen',{'meeting_id':mid}).status_code==302
110
+ assert client.get('/entry/1').status_code==200
111
+
112
+ def test_users_cannot_edit_others_or_admin(client,app):
113
+ login(client,'gokul')
114
+ assert client.get('/admin').status_code==403
115
+ assert client.get('/admin/backup').status_code==403
116
+ assert client.get('/coordinator').status_code==403
117
+ foreign=query(app,"SELECT a.id FROM actions a JOIN users u ON a.user_id=u.id JOIN reviews r ON r.action_id=a.id WHERE u.username='kishan'")[0]['id']
118
+ assert review(client,app,[str(foreign)]).status_code==403
119
+ review(client,app)
120
+ foreign_update=query(app,"SELECT id FROM updates LIMIT 1")[0]['id']
121
+ assert post(client,'/entry/2',{'meeting_id':active(app)['id'],'operation':'delete','item_id':foreign_update}).status_code==404
122
+
123
+ def test_duplicate_posts_and_edit_delete(client,app):
124
+ login(client)
125
+ review(client,app)
126
+ mid=active(app)['id']
127
+ data={'meeting_id':mid,'entry_token':secrets.token_hex(20),'body':'Only once'}
128
+ post(client,'/entry/2',data)
129
+ post(client,'/entry/2',data)
130
+ rows=query(app,'SELECT * FROM updates WHERE meeting_id=?',(mid,))
131
+ assert len(rows)==1
132
+ post(client,'/entry/2',{'meeting_id':mid,'operation':'edit','item_id':rows[0]['id'],'body':'Edited'})
133
+ assert query(app,'SELECT body FROM updates WHERE id=?',(rows[0]['id'],))[0]['body']=='Edited'
134
+ post(client,'/entry/2',{'meeting_id':mid,'operation':'delete','item_id':rows[0]['id']})
135
+ assert not query(app,'SELECT * FROM updates WHERE meeting_id=?',(mid,))
136
+
137
+ def test_coordinator_rotation_and_snapshot(client,app):
138
+ login(client,'harshitha')
139
+ old=active(app)
140
+ own=query(app,"SELECT a.id FROM actions a JOIN users u ON u.id=a.user_id JOIN reviews r ON r.action_id=a.id WHERE u.username='harshitha'")
141
+ completed=own[0]['id']
142
+ review(client,app,[str(completed)])
143
+ due=(date.fromisoformat(old['meeting_date'])+timedelta(days=3)).isoformat()
144
+ add(client,app,3,'Carry me next week',due_date=due)
145
+ new_action=query(app,"SELECT id FROM actions WHERE body='Carry me next week'")[0]['id']
146
+ assert client.get('/coordinator').status_code==200
147
+ assert post(client,'/coordinator',{'meeting_id':old['id'],'operation':'next'}).status_code==302
148
+ new=active(app)
149
+ assert date.fromisoformat(new['meeting_date'])-date.fromisoformat(old['meeting_date'])==timedelta(days=7)
150
+ assert new['minutes_by']=='Gokul M'
151
+ assert client.get('/coordinator').status_code==403
152
+ assert not query(app,'SELECT * FROM reviews WHERE meeting_id=? AND action_id=?',(new['id'],completed))
153
+ assert query(app,'SELECT * FROM reviews WHERE meeting_id=? AND action_id=?',(new['id'],new_action))
154
+ assert query(app,'SELECT completed FROM reviews WHERE meeting_id=? AND action_id=?',(old['id'],completed))[0]['completed']==1
155
+ assert post(client,'/entry/1',{'meeting_id':old['id']}).status_code==409
156
+ assert client.get(f"/reports/{old['id']}").status_code==200
157
+
158
+ def test_excel_literal_text_dates_and_backup(client,app):
159
+ login(client)
160
+ review(client,app)
161
+ mid=active(app)['id']
162
+ add(client,app,2,'=HYPERLINK("https://example.invalid", "text")')
163
+ add(client,app,3,'<script>alert(1)</script>',due_date=active(app)['meeting_date'])
164
+ response=client.get(f'/reports/{mid}')
165
+ assert b'&lt;script&gt;' in response.data
166
+ assert b'<script>alert(1)' not in response.data
167
+ response=client.get(f'/reports/{mid}/excel')
168
+ assert response.status_code==200
169
+ workbook=load_workbook(BytesIO(response.data),read_only=True)
170
+ cells=[c for row in workbook.active.iter_rows(max_col=5) for c in row]
171
+ literal=next(c for c in cells if str(c.value).startswith('=HYPERLINK'))
172
+ assert literal.data_type=='s'
173
+ assert any(getattr(c,'is_date',False) for c in cells)
174
+ workbook.close()
175
+ assert client.get('/admin/backup').data.startswith(b'SQLite format 3')
176
+ assert client.get('/reports/1/original').data.startswith(b'PK')
177
+
178
+ def test_password_reset_revokes_existing_session(client,app):
179
+ login(client)
180
+ member=app.test_client()
181
+ login(member,'gokul')
182
+ uid=query(app,"SELECT id FROM users WHERE username='gokul'")[0]['id']
183
+ assert post(client,'/admin',{'operation':'reset','user_id':uid}).status_code==302
184
+ assert member.get('/').location.endswith('/login')
185
+ login(member,'gokul',change=False)
186
+ assert member.get('/').location.endswith('/password')
187
+
188
+ def test_lockout(client,app):
189
+ client.get('/login')
190
+ for _ in range(5):
191
+ post(client,'/login',{'username':'kishan','password':'wrong'})
192
+ r=post(client,'/login',{'username':'kishan','password':'Password@123'})
193
+ assert b'Too many attempts' in r.data
194
+
195
+ def test_rotation_validation_and_monday_only(client,app):
196
+ login(client)
197
+ mid=active(app)['id']
198
+ r=post(client,'/admin',{'operation':'rotation','order_1':'1','order_2':'1'})
199
+ assert b'unique' in r.data
200
+ next_tuesday=date.fromisoformat(active(app)['meeting_date'])+timedelta(days=8)
201
+ r=post(client,'/admin',{'operation':'meeting','meeting_date':next_tuesday.isoformat(),'title':'Weekly','location':'Office'})
202
+ assert b'must be scheduled on a Monday' in r.data
203
+ assert active(app)['id']==mid
204
+
205
+ def test_rollback_on_invalid_action_does_not_overwrite(client,app):
206
+ login(client)
207
+ review(client,app)
208
+ mid=active(app)['id']
209
+ add(client,app,3,'Original',due_date=active(app)['meeting_date'])
210
+ item=query(app,'SELECT id FROM actions WHERE meeting_id=?',(mid,))[0]['id']
211
+ r=post(client,'/entry/3',{'meeting_id':mid,'operation':'edit','item_id':item,'body':'Changed','due_date':'invalid'})
212
+ assert b'Choose a valid date' in r.data
213
+ assert query(app,'SELECT body FROM actions WHERE id=?',(item,))[0]['body']=='Original'
tests/test_import_and_delegation.py ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from io import BytesIO
2
+ from pathlib import Path
3
+ import secrets
4
+ from importer import parse_report
5
+ from tests.test_app import login,post,query,active,review
6
+
7
+ ROOT=Path(__file__).resolve().parents[1]
8
+
9
+ def test_import_parser_preserves_actions_and_notes():
10
+ content=(ROOT/'sources'/'MOM_Technical Report on 15-09-2026.xlsx').read_bytes()
11
+ report=parse_report(content)
12
+ assert len(report['actions'])==40
13
+ assert len(report['updates'])==89
14
+ assert any(a['due_note']=='Waiting for Client' for a in report['actions'])
15
+ assert any(a['owner']=='Kishan' for a in report['actions'])
16
+
17
+ def test_first_run_upload_preview_confirm_and_idempotency(client,app):
18
+ app.config['REQUIRE_SETUP']=True
19
+ login(client)
20
+ assert client.get('/').location.endswith('/setup')
21
+ content=(ROOT/'sources'/'MOM_Technical Report on 15-09-2026.xlsx').read_bytes()
22
+ result=post(client,'/setup',{'operation':'upload','report':(BytesIO(content),'previous.xlsx')})
23
+ assert result.status_code==302
24
+ preview=client.get('/setup')
25
+ assert b'40 actions' in preview.data
26
+ parsed=parse_report(content)
27
+ users=query(app,'SELECT * FROM users')
28
+ from importer import suggest_owner
29
+ mapping={f'owner_{i}':suggest_owner(name,users) for i,name in enumerate(parsed['owners'])}
30
+ result=post(client,'/setup',{'operation':'confirm','report_date':'2026-09-21','meeting_date':'2026-09-28','coordinator_id':'2',**mapping})
31
+ assert result.status_code==302
32
+ assert client.get('/').status_code==200
33
+ assert query(app,'SELECT COUNT(*) n FROM reviews WHERE meeting_id=?',(active(app)['id'],))[0]['n']==40
34
+ assert post(client,'/setup',{'operation':'confirm'}).status_code==302
35
+ assert query(app,'SELECT COUNT(*) n FROM reviews WHERE meeting_id=?',(active(app)['id'],))[0]['n']==40
36
+ assert client.get('/reports/2/original').data.startswith(b'PK')
37
+
38
+ def test_coordinator_can_act_for_other_people_but_not_rotation_members(client,app):
39
+ login(client,'harshitha')
40
+ mid=active(app)['id']
41
+ vinay=query(app,"SELECT id FROM users WHERE username='vinay'")[0]['id']
42
+ assert b'Vinay' in client.get(f'/entry/1?person={vinay}').data
43
+ own_actions=query(app,'SELECT a.id FROM actions a JOIN reviews r ON r.action_id=a.id WHERE a.user_id=? AND r.meeting_id=?',(vinay,mid))
44
+ selected=own_actions[0]['id']
45
+ assert post(client,f'/entry/1?person={vinay}',{'meeting_id':mid,'completed':[str(selected)]}).status_code==302
46
+ assert post(client,f'/entry/2?person={vinay}',{'meeting_id':mid,'entry_token':secrets.token_hex(20),'body':'Update entered by coordinator'}).status_code==302
47
+ assert post(client,f'/entry/3?person={vinay}',{'meeting_id':mid,'entry_token':secrets.token_hex(20),'body':'Action entered by coordinator','due_date':active(app)['meeting_date']}).status_code==302
48
+ assert post(client,f'/entry/4?person={vinay}',{'meeting_id':mid}).location.endswith('/coordinator')
49
+ assert query(app,'SELECT user_id FROM updates WHERE meeting_id=?',(mid,))[0]['user_id']==vinay
50
+ assert client.get('/entry/1?person=3').status_code==403
51
+ assert client.get('/admin').status_code==403
52
+ post(client,f'/reopen?person={vinay}',{'meeting_id':mid})
53
+ assert client.get(f'/entry/1?person={vinay}').status_code==200
54
+ post(client,'/coordinator',{'meeting_id':mid,'operation':'next'})
55
+ assert client.get(f'/entry/1?person={vinay}').status_code==403
56
+
57
+ def test_others_entries_are_coordinator_managed(client,app):
58
+ login(client,'vinay')
59
+ assert client.get('/entry/1').status_code==403
60
+ assert client.get('/reports').status_code==200
61
+
62
+ def test_import_rejects_bad_file_without_changing_actions(client,app):
63
+ login(client)
64
+ old_count=query(app,'SELECT COUNT(*) n FROM actions')[0]['n']
65
+ response=post(client,'/setup',{'operation':'upload','report':(BytesIO(b'not an excel file'),'bad.xlsx')})
66
+ assert b'Unable to read' in response.data
67
+ assert query(app,'SELECT COUNT(*) n FROM actions')[0]['n']==old_count
tests/test_preparation_date.py ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from datetime import timedelta
2
+ from io import BytesIO
3
+ from openpyxl import load_workbook
4
+ from app import preparation_days,create_app
5
+ from tests.test_app import active,post,query
6
+
7
+ def sign_in(client,app,name='harshitha'):
8
+ # Dates are tested independently of the already-covered password flow.
9
+ import sqlite3
10
+ with sqlite3.connect(app.config['DATABASE']) as db:
11
+ db.execute('UPDATE users SET must_change=0 WHERE username=?',(name,))
12
+ user=query(app,'SELECT * FROM users WHERE username=?',(name,))[0]
13
+ with client.session_transaction() as session:
14
+ session['user_id']=user['id']
15
+ session['version']=user['session_version']
16
+ session['csrf']='date-test'
17
+
18
+ def test_workweek_date_options():
19
+ assert [d.isoformat() for d in preparation_days('2026-09-28')]==[
20
+ '2026-09-28','2026-09-29','2026-09-30','2026-10-01','2026-10-02']
21
+ assert [d.isoformat() for d in preparation_days('2027-01-04')]==[
22
+ '2027-01-04','2027-01-05','2027-01-06','2027-01-07','2027-01-08']
23
+
24
+ def test_coordinator_selects_weekdays_without_rotating(client,app):
25
+ sign_in(client,app)
26
+ meeting=active(app)
27
+ for day in preparation_days(meeting['meeting_date']):
28
+ response=post(client,'/coordinator',{'operation':'preparation_date','meeting_id':meeting['id'],'prepared_on':day.isoformat()})
29
+ assert response.status_code==302
30
+ saved=active(app)
31
+ assert saved['prepared_on']==day.isoformat()
32
+ assert saved['coordinator_id']==meeting['coordinator_id']
33
+ assert saved['meeting_date']==meeting['meeting_date']
34
+ page=client.get('/coordinator')
35
+ assert b'Friday,' in page.data and b'Report preparation date' in page.data
36
+ response=client.get(f"/reports/{meeting['id']}/excel")
37
+ book=load_workbook(BytesIO(response.data),read_only=True)
38
+ assert book.active['A4'].value=='Meeting Date'
39
+ assert book.active['C4'].value.endswith(__import__('datetime').date.fromisoformat(meeting['meeting_date']).strftime('%d-%b-%Y'))
40
+ book.close()
41
+ assert client.get(f"/reports/{meeting['id']}").status_code==200
42
+ create_app({'TESTING':True,'DATABASE':app.config['DATABASE'],'SECRET_KEY':'test-secret','REQUIRE_SETUP':False})
43
+ assert active(app)['prepared_on']==saved['prepared_on']
44
+ post(client,'/coordinator',{'operation':'next','meeting_id':meeting['id']})
45
+ assert active(app)['prepared_on'] is None
46
+ assert active(app)['minutes_by']=='Gokul M'
47
+ assert query(app,'SELECT prepared_on FROM meetings WHERE id=?',(meeting['id'],))[0]['prepared_on']==saved['prepared_on']
48
+
49
+ def test_preparation_date_rejects_weekends_other_weeks_and_members(client,app):
50
+ sign_in(client,app)
51
+ meeting=active(app)
52
+ monday=preparation_days(meeting['meeting_date'])[0]
53
+ for offset in [-1,5,6,7]:
54
+ value=(monday+timedelta(days=offset)).isoformat()
55
+ response=post(client,'/coordinator',{'operation':'preparation_date','meeting_id':meeting['id'],'prepared_on':value})
56
+ assert b'Choose a working day' in response.data
57
+ assert active(app)['prepared_on'] is None
58
+ sign_in(client,app,'gokul')
59
+ assert post(client,'/coordinator',{'operation':'preparation_date','meeting_id':meeting['id'],'prepared_on':monday.isoformat()}).status_code==403
tests/test_workbook_copy.py ADDED
@@ -0,0 +1,125 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from datetime import date,timedelta
2
+ from io import BytesIO
3
+ from pathlib import Path
4
+ from zipfile import ZipFile
5
+ import hashlib
6
+ import sqlite3
7
+ from xml.dom import minidom
8
+ from exporter import export_report,Sheet,nodes,text,worksheet_paths
9
+ from tests.test_app import active,query
10
+ from tests.test_preparation_date import sign_in
11
+
12
+ SOURCE=Path(__file__).resolve().parents[1]/'sources'/'MOM_Technical Report on 15-09-2026.xlsx'
13
+
14
+ def unpack(content):
15
+ with ZipFile(BytesIO(content)) as z:parts={i.filename:z.read(i.filename) for i in z.infolist()}
16
+ shared=minidom.parseString(parts['xl/sharedStrings.xml']) if 'xl/sharedStrings.xml' in parts else None
17
+ strings=[text(n) for n in nodes(shared,'si')] if shared else []
18
+ sheets={name:Sheet(parts[path],strings) for name,path in worksheet_paths(parts)}
19
+ return parts,sheets
20
+
21
+ def records(sheet):
22
+ return [[sheet.value(r,col) for col in 'ABCDE'] for n,r in sorted(sheet.rows.items()) if n>1 and any(sheet.value(r,c) for c in 'BDE')]
23
+
24
+ def sample(app,mid=None):
25
+ mid=mid or active(app)['id']
26
+ meeting=dict(query(app,'SELECT * FROM meetings WHERE id=?',(mid,))[0])
27
+ users=query(app,'SELECT * FROM users ORDER BY id')
28
+ user_ids={u['username']:u['id'] for u in users}
29
+ reviews=[dict(r) for r in query(app,'SELECT a.*,u.name,rv.completed checked FROM reviews rv JOIN actions a ON a.id=rv.action_id JOIN users u ON u.id=a.user_id WHERE rv.meeting_id=?',(mid,))]
30
+ reviews[0]['checked']=1;reviews[1]['checked']=1
31
+ return dict(meeting=meeting,users=users,
32
+ updates=[dict(user_id=user_ids['madhav'],body=f'New update {i}') for i in range(12)]+[dict(user_id=user_ids['kishan'],body='=literal update')]+[dict(user_id=user_ids['niranjan'],body='New participant update')],
33
+ actions=[dict(user_id=user_ids['kishan'],name='Kishan H M',body='Only this week action',due_date=meeting['meeting_date'],due_note='')],reviews=reviews)
34
+
35
+ def test_copy_replaces_resizes_renumbers_and_preserves_archive(app):
36
+ original=SOURCE.read_bytes();digest=hashlib.sha256(original).hexdigest()
37
+ data=sample(app)
38
+ result=export_report(data,original).getvalue()
39
+ oldparts,old=unpack(original);parts,sheets=unpack(result)
40
+ assert set(sheets)=={'MOM','CLOSED'}
41
+ changed={name for name in oldparts if oldparts[name]!=parts[name]}
42
+ assert changed=={'xl/worksheets/sheet1.xml','xl/worksheets/sheet2.xml'}
43
+ assert hashlib.sha256(SOURCE.read_bytes()).hexdigest()==digest
44
+ mom=sheets['MOM'];owner=None;sections={};action_rows=[]
45
+ for _,r in sorted(mom.rows.items()):
46
+ a,b,c,d=[mom.value(r,col) for col in 'ABCD']
47
+ if a.startswith('Updates from '):owner=a.removeprefix('Updates from ').strip();sections[owner]=[]
48
+ elif b=='Actions':owner=None
49
+ elif a.isdigit() and owner:sections[owner].append((int(a),b))
50
+ elif a.isdigit() and b:action_rows.append((int(a),b,c,d))
51
+ assert len(sections['Madhav'])==12
52
+ assert sections['Kishan']==[(1,'=literal update')]
53
+ assert sections['Harshitha']==[]
54
+ assert sections['Niranjan']==[(1,'New participant update')]
55
+ assert [n for n,_ in sections['Madhav']]==list(range(1,13))
56
+ assert len(action_rows)==1 and action_rows[0][1]=='Only this week action'
57
+ assert all(a['body'] not in [r[1] for r in action_rows] for a in data['reviews'])
58
+ oldrecords=records(old['CLOSED']);closedrecords=records(sheets['CLOSED'])
59
+ assert [r[1:] for r in closedrecords[:len(oldrecords)]]==[r[1:] for r in oldrecords]
60
+ assert len(closedrecords)==len(oldrecords)+2
61
+ assert [int(r[0]) for r in closedrecords]==list(range(1,len(closedrecords)+1))
62
+ assert [r[4] for r in closedrecords[-2:]]==['Completed','Completed']
63
+ assert closedrecords[-2][1]==data['reviews'][0]['body']
64
+ assert closedrecords[-2][3]==data['reviews'][0]['name']
65
+ assert mom.value(mom.rows[4],'C')==date.fromisoformat(data['meeting']['meeting_date']).strftime('%A %d-%b-%Y')
66
+ assert any('Next weekly meeting on '+(date.fromisoformat(data['meeting']['meeting_date'])+timedelta(days=7)).strftime('%d-%m-%Y')==mom.value(r,'A') for r in mom.rows.values())
67
+ assert export_report(data,original).getvalue()==result
68
+
69
+ def test_next_copy_keeps_closed_history_but_not_old_week_entries(app):
70
+ source=SOURCE.read_bytes();first=sample(app)
71
+ previous=export_report(first,source).getvalue()
72
+ second=sample(app);second['meeting']['meeting_date']=(date.fromisoformat(first['meeting']['meeting_date'])+timedelta(days=7)).isoformat()
73
+ second['updates']=[];second['actions']=[];second['reviews']=[dict(first['reviews'][2],checked=1)]
74
+ result=export_report(second,previous,style_workbook=source).getvalue()
75
+ _,old=unpack(source);_,new=unpack(result)
76
+ assert len(records(new['CLOSED']))==len(records(old['CLOSED']))+3
77
+ assert not any(new['MOM'].value(row,'A').isdigit() and new['MOM'].value(row,'B') for row in new['MOM'].rows.values())
78
+ from importer import parse_report
79
+ assert parse_report(result)['actions']==[]
80
+ # Empty weeks must not lose the original row styles for a later populated week.
81
+ third=sample(app);third['reviews']=[]
82
+ later=export_report(third,result,style_workbook=source).getvalue()
83
+ _,sheets=unpack(later)
84
+ assert any(sheets['MOM'].value(r,'B')=='Only this week action' for r in sheets['MOM'].rows.values())
85
+
86
+ def test_route_creates_copy_and_keeps_unfinished_in_database(client,app):
87
+ sign_in(client,app)
88
+ meeting=active(app);before=query(app,'SELECT * FROM actions')
89
+ uid=query(app,"SELECT id FROM users WHERE username='harshitha'")[0]['id']
90
+ with sqlite3.connect(app.config['DATABASE']) as db:
91
+ db.execute('INSERT INTO updates(meeting_id,user_id,body) VALUES(?,?,?)',(meeting['id'],uid,'Current update'))
92
+ db.execute('INSERT INTO actions(meeting_id,user_id,body,due_date) VALUES(?,?,?,?)',(meeting['id'],uid,'Current action',meeting['meeting_date']))
93
+ db.execute('UPDATE reviews SET completed=1 WHERE meeting_id=? AND action_id=(SELECT MIN(action_id) FROM reviews WHERE meeting_id=?)',(meeting['id'],meeting['id']))
94
+ response=client.get(f"/reports/{meeting['id']}/excel")
95
+ assert response.status_code==200
96
+ _,sheets=unpack(response.data)
97
+ bodies=[sheets['MOM'].value(r,'B') for r in sheets['MOM'].rows.values()]
98
+ assert 'Current action' in bodies
99
+ assert all(a['body'] not in bodies for a in before)
100
+ assert len(query(app,'SELECT * FROM actions'))==len(before)+1
101
+ filename=f"MOM_Technical Report on {date.fromisoformat(meeting['meeting_date']).strftime('%d-%m-%Y')}.xlsx"
102
+ assert (Path(app.config['DATABASE']).parent/'reports'/filename).exists()
103
+ assert client.get(f"/reports/{meeting['id']}/excel").data==response.data
104
+
105
+ def test_action_rows_expand_and_dates_survive_roundtrip(app):
106
+ from openpyxl import load_workbook
107
+ data=sample(app)
108
+ data['actions']=[dict(data['actions'][0],body=f'Weekly action {i}') for i in range(55)]
109
+ result=export_report(data,SOURCE.read_bytes()).getvalue()
110
+ book=load_workbook(BytesIO(result),read_only=True)
111
+ rows=list(book['MOM'].iter_rows(max_col=5,values_only=True))
112
+ actions=[row for row in rows if isinstance(row[1],str) and row[1].startswith('Weekly action')]
113
+ assert [r[0] for r in actions]==list(range(1,56))
114
+ assert all(hasattr(r[2],'date') for r in actions)
115
+ book.close()
116
+
117
+ def test_action_picker_exposes_preceding_workweek_dates(client,app):
118
+ from tests.test_app import review,add
119
+ sign_in(client,app,'kishan');review(client,app)
120
+ meeting=active(app)
121
+ monday=date.fromisoformat(meeting['meeting_date'])
122
+ page=client.get('/entry/3')
123
+ assert f'min="{(monday-timedelta(days=7)).isoformat()}"'.encode() in page.data
124
+ assert f'max="{(monday+timedelta(days=7)).isoformat()}"'.encode() in page.data
125
+ assert add(client,app,3,'Working-week action',due_date=(monday-timedelta(days=5)).isoformat()).status_code==302
validation/VERIFICATION.md ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Verification
2
+
3
+ - 16 automated tests passed against temporary SQLite databases.
4
+ - A real headless Microsoft Edge browser completed first login, mandatory password change, first-run Excel upload, owner preview and confirmation, dashboard display, coordinator entry for Vinay, previous-action completion, a saved update, a dated action, submission and Excel download.
5
+ - Browser reported no JavaScript errors.
6
+ - Desktop screenshots (1440 px wide) and mobile screenshot (390 px wide) were inspected. The mobile dashboard has no horizontal page overflow; its navigation scrolls horizontally.
7
+ - Source workbook originals are retained unchanged under `sources/`.
8
+ - Real account data is separate from browser validation data.
9
+ - The built-in browser automation timed out; validation used a separate local Edge browser instead.
10
+
11
+ The Excel export was reopened and checked for typed dates, literal user text (including formula-like strings), and a successful browser download. Its page layout was not visually checked inside Microsoft Excel.
12
+
13
+ ## Workbook-copy export revision
14
+
15
+ - 23 regression tests passed after the export change, including login, coordinator permissions, imports, date selection and workbook-copy behavior.
16
+ - The workbook keeps the exact MOM and CLOSED sheet names. Package comparisons confirm that only those two worksheet XML members change for the supplied source. Styles, images, drawings, relationships and other package members remain byte-for-byte unchanged.
17
+ - Checked more/fewer/zero updates, more/fewer/zero actions, new participant headings, per-person and action serial numbering, continuous CLOSED serials, original CLOSED record preservation, literal formula-like text, and typed due dates.
18
+ - Repeated export starts from the original baseline and reconstructs weekly copies, so it does not append duplicate CLOSED entries. A subsequent week's copy retains prior CLOSED history and removes prior-week MOM content.
19
+ - Unfinished prior actions remain in SQLite and do not enter the exported MOM sheet.
20
+ - The file is saved under data/reports with the meeting date. Original uploaded workbooks are not changed.
21
+ - The HTML action date input now uses the same minimum/maximum as server validation, including preceding-week dates. Preparation dates are Monday-Friday after the meeting, following the user's clarification.
validation/browser-result.json ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "passed": true,
3
+ "checks": [
4
+ "login and forced password change",
5
+ "upload and owner preview",
6
+ "setup confirmation",
7
+ "desktop and mobile dashboard",
8
+ "coordinator delegation for Vinay",
9
+ "completion review",
10
+ "saved update",
11
+ "dated action",
12
+ "submission",
13
+ "Excel download"
14
+ ],
15
+ "javascriptErrors": [],
16
+ "mobileOverflow": false
17
+ }
validation/browser_check.cjs ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ const { chromium } = require('C:/Users/Sowmya/.cache/codex-runtimes/codex-primary-runtime/dependencies/node/node_modules/playwright');
2
+ const path = require('path');
3
+ const fs = require('fs');
4
+ (async () => {
5
+ const browser = await chromium.launch({channel:'msedge',headless:true});
6
+ const page = await browser.newPage({viewport:{width:1440,height:1000}});
7
+ const errors=[];
8
+ page.on('pageerror',e=>errors.push(String(e)));
9
+ async function login(username) {
10
+ await page.goto('http://127.0.0.1:5001/login');
11
+ await page.getByLabel('Team member').selectOption(username);
12
+ await page.getByLabel('Password',{exact:true}).fill('Password@123');
13
+ await page.getByRole('button',{name:'Sign in',exact:false}).click();
14
+ await page.getByLabel('Current password',{exact:true}).fill('Password@123');
15
+ await page.getByLabel('New password',{exact:true}).fill('BrowserTest@456');
16
+ await page.getByLabel('Confirm new password',{exact:true}).fill('BrowserTest@456');
17
+ await page.getByRole('button',{name:'Save password & continue',exact:false}).click();
18
+ }
19
+ await page.goto('http://127.0.0.1:5001/login');
20
+ await page.screenshot({path:'validation/login-desktop.png',fullPage:true});
21
+ await login('kishan');
22
+ await page.getByLabel('Previous MOM workbook', {exact:false}).setInputFiles(path.resolve('sources/MOM_Technical Report on 15-09-2026.xlsx'));
23
+ await page.getByRole('button',{name:'Read report & preview',exact:false}).click();
24
+ await page.getByLabel('Actual date of the old meeting').fill('2026-09-21');
25
+ await page.getByLabel('Upcoming meeting (Monday)',{exact:true}).first().fill('2026-09-28');
26
+ await page.screenshot({path:'validation/import-preview.png',fullPage:true});
27
+ await page.getByRole('button',{name:'Confirm import & open workspace',exact:false}).click();
28
+ await page.getByRole('heading',{name:'Hello, Kishan.'}).waitFor();
29
+ await page.screenshot({path:'validation/dashboard-desktop.png',fullPage:true});
30
+ await page.setViewportSize({width:390,height:844});
31
+ await page.screenshot({path:'validation/dashboard-mobile.png',fullPage:true});
32
+ const overflow=await page.evaluate(()=>document.documentElement.scrollWidth>window.innerWidth);
33
+ if(overflow)throw new Error('Mobile dashboard has horizontal overflow');
34
+ await page.setViewportSize({width:1440,height:1000});
35
+ await page.getByRole('button',{name:'Sign out',exact:true}).click();
36
+ await login('harshitha');
37
+ await page.getByRole('link',{name:'Coordinate meeting',exact:false}).click();
38
+ await page.screenshot({path:'validation/coordinator-desktop.png',fullPage:true});
39
+ const card=page.locator('.delegate-card').filter({has:page.getByRole('heading',{name:'Vinay',exact:true})});
40
+ await card.getByRole('link',{name:'Prepare entry',exact:false}).click();
41
+ await page.locator('input[type=checkbox]').first().check();
42
+ await page.getByRole('button',{name:'Save & continue',exact:false}).click();
43
+ await page.getByLabel('What have you worked on?').fill('Confirmed the screen-pop integration after the weekly review.');
44
+ await page.getByRole('button',{name:'Save update',exact:false}).click();
45
+ await page.screenshot({path:'validation/updates-desktop.png',fullPage:true});
46
+ await page.getByRole('button',{name:'Continue to actions',exact:false}).click();
47
+ await page.getByLabel('What needs to be done?').fill('Complete the remaining integration checks.');
48
+ await page.getByLabel('Due date',{exact:true}).fill('2026-09-30');
49
+ await page.getByRole('button',{name:'Save action',exact:false}).click();
50
+ await page.getByRole('button',{name:'Review my entry',exact:false}).click();
51
+ await page.getByRole('button',{name:'Submit meeting entry',exact:false}).click();
52
+ await page.getByRole('link',{name:'Review full report',exact:false}).click();
53
+ const downloadPromise=page.waitForEvent('download');
54
+ await page.getByRole('link',{name:'Download Excel',exact:false}).click();
55
+ const download=await downloadPromise;
56
+ await download.saveAs('validation/browser-report.xlsx');
57
+ if(errors.length)throw new Error(errors.join('\n'));
58
+ fs.writeFileSync('validation/browser-result.json',JSON.stringify({passed:true,checks:['login and forced password change','upload and owner preview','setup confirmation','desktop and mobile dashboard','coordinator delegation for Vinay','completion review','saved update','dated action','submission','Excel download'],javascriptErrors:errors,mobileOverflow:overflow},null,2));
59
+ console.log('Browser workflow passed, including upload, coordinator delegation, mobile layout and Excel download.');
60
+ await browser.close();
61
+ })().catch(e=>{console.error(e);process.exit(1)});
validation/final_check.py ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from pathlib import Path
2
+ import sqlite3
3
+ from app import create_app
4
+ from importer import parse_report
5
+
6
+ root=Path(__file__).resolve().parents[1]
7
+ app=create_app({'TESTING':True,'DATABASE':str(root/'validation'/'ui-data'/'mom.sqlite3'),'SECRET_KEY':'verification-only'})
8
+ client=app.test_client()
9
+ with sqlite3.connect(app.config['DATABASE']) as db:
10
+ uid,version=db.execute("SELECT id,session_version FROM users WHERE username='kishan'").fetchone()
11
+ with client.session_transaction() as session:
12
+ session['user_id']=uid
13
+ session['version']=version
14
+ assert client.get('/reports/2').status_code==200
15
+ assert b'Uploaded previous MOM report' in client.get('/reports/2').data
16
+ assert b'upload:' not in client.get('/reports/2').data
17
+ assert client.get('/reports/2/excel').status_code==200
18
+ report=parse_report((root/'validation'/'browser-report.xlsx').read_bytes())
19
+ assert len(report['actions'])==41
20
+ assert sum(a['completed'] for a in report['actions'])==1
21
+ print('Final report labels and Excel re-import passed (41 actions, 1 already completed).')
validation/fix_action_date_inputs.py ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ from pathlib import Path
2
+ p=Path('templates/workflow.html')
3
+ s=p.read_text(encoding='utf-8')
4
+ old='min="{{ meeting.meeting_date }}"'
5
+ assert s.count(old)==2
6
+ s=s.replace(old,'min="{{ action_min }}" max="{{ action_max }}"')
7
+ p.write_text(s,encoding='utf-8')
validation/inspect_template.py ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from pathlib import Path
2
+ from zipfile import ZipFile
3
+ import xml.etree.ElementTree as E
4
+ S='{http://schemas.openxmlformats.org/spreadsheetml/2006/main}'
5
+ p=Path('sources/MOM_Technical Report on 15-09-2026.xlsx')
6
+ with ZipFile(p) as z:
7
+ print(z.read('xl/workbook.xml').decode()[:4500])
8
+ strings=[''.join(n.itertext()) for n in E.fromstring(z.read('xl/sharedStrings.xml')).findall(S+'si')]
9
+ for path in ['xl/worksheets/sheet1.xml','xl/worksheets/sheet2.xml']:
10
+ root=E.fromstring(z.read(path));rows=root.find(S+'sheetData').findall(S+'row')
11
+ print('\nSHEET',path,'rows',len(rows),'merges',[(n.attrib) for n in root.findall(S+'mergeCells/'+S+'mergeCell')][:20])
12
+ records=[]
13
+ for row in rows:
14
+ vals=[]
15
+ for c in row:
16
+ v=c.find(S+'v')
17
+ if v is not None:vals.append((c.get('r'),strings[int(v.text)] if c.get('t')=='s' else v.text,c.get('s')))
18
+ if vals:records.append((row.get('r'),vals))
19
+ print('HEAD',records[:15]);print('TAIL',records[-15:])
20
+ print('EXTRAS',[(n.tag.split('}')[-1],E.tostring(n).decode()[:1100]) for n in root if n.tag!=S+'sheetData' and n.tag!=S+'mergeCells'])
validation/prepare_ui.py ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from pathlib import Path
2
+ import sqlite3
3
+ from app import create_app
4
+
5
+ root=Path(__file__).resolve().parents[1]
6
+ create_app()
7
+ destination=root/'validation'/'ui-data'
8
+ destination.mkdir(parents=True,exist_ok=True)
9
+ source=sqlite3.connect(root/'data'/'mom.sqlite3')
10
+ target=sqlite3.connect(destination/'mom.sqlite3')
11
+ source.backup(target)
12
+ source.close()
13
+ target.close()
14
+ print('Created isolated browser-test database. Real accounts are unchanged.')
validation/update_copy_docs.py ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from pathlib import Path
2
+ p=Path('templates/report.html');s=p.read_text(encoding='utf-8')
3
+ s=s.replace('This report includes saved drafts. Each member’s submission status appears below. Previous-action statuses are saved for this meeting.','Excel downloads copy the previous workbook. Only this week’s updates and new actions appear in MOM. Completed previous actions are appended to CLOSED; unfinished actions remain in app history. Saved drafts are included.')
4
+ s=s.replace('<h2>Previous action review</h2>','<h2>Previous action history (app only)</h2>')
5
+ p.write_text(s,encoding='utf-8')
6
+ p=Path('README.md');s=p.read_text(encoding='utf-8')
7
+ s=s.replace('any Monday–Friday in the working week before the scheduled meeting. For example, the 28 September meeting offers 21–25 September. This date is saved separately and appears in the report and Excel download.','any Monday–Friday in the reporting week after the meeting. For example, the 28 September meeting offers 28 September–2 October. This preparation date is saved separately and shown in the app; the Excel meeting date stays on Monday to preserve the source layout.')
8
+ s=s.replace('New actions cannot have due dates before their meeting date.','New action dates can be selected from the preceding Monday through the following Monday, including the working-week dates shown in the action form.')
9
+ s=s.replace('Excel downloads are newly generated reports with the same updates/action structure and an extra status column. They are not byte-for-byte reproductions of the source\'s styling or additional sheets. Long entries wrap; very long paragraphs may need row-height adjustment in Excel when printing.','Excel downloads edit a copy of the previous workbook, retaining its MOM and CLOSED sheets, styles, images and other workbook parts. The meeting date and next-meeting footer advance. Each existing person’s update rows are replaced with only the current week’s updates; rows are inserted or removed and serial numbers restart at 1 per person. The action table contains only current-week new actions, with due dates and serial numbers starting at 1. Completed previous actions append to CLOSED with owner and Completed status, continuing its serial numbers. Historical CLOSED records are retained. Unfinished previous actions are kept in SQLite/app history and are omitted from Excel. Repeated downloads do not duplicate archive entries. Copies are saved in data/reports and downloaded with the meeting date in their filename. Very long paragraphs may need row-height adjustment in Excel when printing.')
10
+ s=s.replace('- `data/imports/`: uploaded original workbooks and import previews.','- `data/imports/`: uploaded original workbooks and import previews.\n- `data/reports/`: dated copies produced by Excel downloads (regenerable from the database and original workbook).')
11
+ p.write_text(s,encoding='utf-8')
validation/update_preparation_templates.py ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from pathlib import Path
2
+
3
+ path=Path('templates/coordinator.html')
4
+ text=path.read_text(encoding='utf-8')
5
+ anchor="{% include 'coordinator_people.html' %}"
6
+ assert anchor in text
7
+ path.write_text(text.replace(anchor,anchor+"{% include 'preparation_date.html' %}"),encoding='utf-8')
8
+ path=Path('templates/report.html')
9
+ text=path.read_text(encoding='utf-8')
10
+ anchor='<div><span>Presented by</span>'
11
+ assert anchor in text
12
+ path.write_text(text.replace(anchor,'<div><span>Report prepared on</span><strong>{{ meeting.prepared_on|datefmt if meeting.prepared_on else "Not selected" }}</strong></div>'+anchor),encoding='utf-8')