diff --git a/README.md b/README.md index 4d2a160..8a3171f 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Theme Song Booth -**Version:** `v0.4.2` +**Version:** `v0.4.3` A Flask web app for a convention booth where visitors request a custom AI-generated theme song, the operator manages the queue, and the final MP3(s) are delivered by email after payment. diff --git a/VERSION b/VERSION index 2b7c5ae..17b2ccd 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.4.2 +0.4.3 diff --git a/app.py b/app.py index 323b7b3..5d8452a 100644 --- a/app.py +++ b/app.py @@ -621,7 +621,7 @@ def play(token): # Load runtime max revisions setting. max_revisions = get_max_revisions() - revisions_left = max(0, max_revisions - (req.get('revision_count') or 0)) + revisions_left = max(0, max_revisions - int(req.get('revision_count') or 0)) return render_template('player.html', req=req, revisions_left=revisions_left) @@ -661,7 +661,7 @@ def revise(token): # Enforce max revisions limit for customer-submitted revisions. max_revisions = get_max_revisions() - current_count = req.get('revision_count') or 0 + current_count = int(req.get('revision_count') or 0) if current_count >= max_revisions: flash('Revision limit reached. Please speak to the booth operator if you need further changes.', 'error') return redirect(url_for('play', token=token)) @@ -689,7 +689,7 @@ def revise(token): log_revision(req['id'], new_count, note, old_a=old_a, old_b=old_b, new_a=new_a, new_b=new_b) update_request(req['id'], revision_note=note, status='revisions_requested', song_a_path=req.get('song_a_path'), song_b_path=req.get('song_b_path'), - customer_approved='none', revision_count=new_count) + customer_approved='none', revision_count=int(new_count)) # NOTE: No operator email is sent; the dashboard is the single queue. flash('Your feedback has been saved. We will regenerate and update you.', 'success') diff --git a/models.py b/models.py index abad0b5..e8d6da6 100644 --- a/models.py +++ b/models.py @@ -117,8 +117,9 @@ def init_db(): existing = {r['name'] for r in db.execute(f"PRAGMA table_info({table})")} for col in columns: if col not in existing: - # Use a safe default type; NULLable for all current optional columns. - db.execute(f'ALTER TABLE {table} ADD COLUMN {col} TEXT') + # revision_count must be INTEGER so arithmetic in app.py works. + col_type = 'INTEGER' if col == 'revision_count' else 'TEXT' + db.execute(f'ALTER TABLE {table} ADD COLUMN {col} {col_type}') db.commit() db.close()