Get line count analysis data for the current game
()
| 1187 | @app.route("/analysis/line-counts") |
| 1188 | @print_timing |
| 1189 | def analysis_line_counts(): |
| 1190 | """Get line count analysis data for the current game""" |
| 1191 | # Don't allow analysis in static mode - skip freezing |
| 1192 | if STATIC_MODE: |
| 1193 | return redirect(url_for("index")) |
| 1194 | |
| 1195 | selected_folder = request.args.get("folder") |
| 1196 | |
| 1197 | if not selected_folder: |
| 1198 | return jsonify({"success": False, "error": "No folder specified"}) |
| 1199 | |
| 1200 | # Validate the selected folder exists and is a game folder |
| 1201 | logs_dir = LOG_BASE_DIR |
| 1202 | folder_path = logs_dir / selected_folder |
| 1203 | |
| 1204 | if not folder_path.exists() or not is_game_folder(folder_path): |
| 1205 | return jsonify({"success": False, "error": "Invalid folder"}) |
| 1206 | |
| 1207 | try: |
| 1208 | analysis_data = _analyze_line_counts_impl(folder_path) |
| 1209 | return jsonify({"success": True, "data": analysis_data}) |
| 1210 | except TimeoutError: |
| 1211 | logger.error(f"Timeout while analyzing line counts for {selected_folder}") |
| 1212 | return jsonify({"success": False, "error": "Request timed out after 2 minutes"}), 504 |
| 1213 | except Exception as e: |
| 1214 | return jsonify({"success": False, "error": str(e)}) |
| 1215 | |
| 1216 | |
| 1217 | @app.route("/download-file") |
nothing calls this directly
no test coverage detected