@@ -250,39 +250,41 @@ def get_categories() -> dict[str, list[dict]]:
250250def utility_processor ():
251251 def get_card_type (category , demo ):
252252 # Add a check for the existence of 'id' and its type
253- demo_id = demo .get ('id' )
254- if category == 'visualizations' or (isinstance (demo_id , str ) and demo_id .startswith ('viz.' )):
255- return 'visualization-card'
256- if 'leetcode' in category :
257- return 'leetcode-card'
258- return 'algorithm-card'
253+ demo_id = demo .get ("id" )
254+ if category == "visualizations" or (
255+ isinstance (demo_id , str ) and demo_id .startswith ("viz." )
256+ ):
257+ return "visualization-card"
258+ if "leetcode" in category :
259+ return "leetcode-card"
260+ return "algorithm-card"
259261
260262 def get_demo_status (demo ):
261263 # Placeholder logic for demo status
262- if ' TODO' in demo .get (' title' , '' ).upper ():
263- return ' todo'
264- if demo .get ('id' ) and hash (demo ['id' ]) % 5 == 0 :
265- return ' partial'
266- return ' complete'
264+ if " TODO" in demo .get (" title" , "" ).upper ():
265+ return " todo"
266+ if demo .get ("id" ) and hash (demo ["id" ]) % 5 == 0 :
267+ return " partial"
268+ return " complete"
267269
268270 def get_progress_percentage (demo ):
269271 status = get_demo_status (demo )
270- if status == ' complete' :
272+ if status == " complete" :
271273 return 100
272- if status == ' partial' :
274+ if status == " partial" :
273275 return 50
274276 return 0
275277
276278 def get_progress_text (demo ):
277279 status = get_demo_status (demo )
278- if status == ' complete' :
280+ if status == " complete" :
279281 return "Completed"
280- if status == ' partial' :
282+ if status == " partial" :
281283 return "In Progress"
282284 return "Not Started"
283-
285+
284286 def get_category_progress (category , demos ):
285- completed = sum (1 for d in demos if get_demo_status (d ) == ' complete' )
287+ completed = sum (1 for d in demos if get_demo_status (d ) == " complete" )
286288 return int ((completed / len (demos )) * 100 ) if demos else 0
287289
288290 return dict (
@@ -298,11 +300,10 @@ def get_category_progress(category, demos):
298300def index ():
299301 # Build categories with additional top-level visualization entries for the dashboard
300302 categories = {k : v [:] for k , v in get_categories ().items ()}
301-
303+
302304 # Add LeetCode problems to categories
303305 from src .interview_workbook .leetcode ._registry import get_all as get_all_leetcode
304- from src .interview_workbook .leetcode ._types import Category
305-
306+
306307 leetcode_problems = get_all_leetcode ()
307308 for problem in leetcode_problems :
308309 category_key = f"leetcode/{ problem ['category' ].value } "
@@ -311,13 +312,55 @@ def index():
311312 # Add visualizations
312313 categories .setdefault ("visualizations" , [])
313314 visualizations = [
314- {"id" : "viz.sorting" , "title" : "Sorting Visualizations" , "category" : "visualizations" , "module" : "viz.sorting" , "path" : "flask_app/visualizations/sorting_viz.py" },
315- {"id" : "viz.graph" , "title" : "Graph Traversal (BFS/DFS)" , "category" : "visualizations" , "module" : "viz.graph" , "path" : "flask_app/visualizations/graph_viz.py" },
316- {"id" : "viz.path" , "title" : "Pathfinding (A*/Dijkstra/BFS/GBFS)" , "category" : "visualizations" , "module" : "viz.path" , "path" : "flask_app/visualizations/path_viz.py" },
317- {"id" : "viz.arrays" , "title" : "Array Techniques" , "category" : "visualizations" , "module" : "viz.arrays" , "path" : "flask_app/visualizations/array_viz.py" },
318- {"id" : "viz.mst" , "title" : "Minimum Spanning Tree (Kruskal/Prim)" , "category" : "visualizations" , "module" : "viz.mst" , "path" : "flask_app/visualizations/mst_viz.py" },
319- {"id" : "viz.topo" , "title" : "Topological Sort (Kahn)" , "category" : "visualizations" , "module" : "viz.topo" , "path" : "flask_app/visualizations/topo_viz.py" },
320- {"id" : "viz.nn" , "title" : "Neural Network (MLP Classifier)" , "category" : "visualizations" , "module" : "viz.nn" , "path" : "flask_app/visualizations/nn_viz.py" },
315+ {
316+ "id" : "viz.sorting" ,
317+ "title" : "Sorting Visualizations" ,
318+ "category" : "visualizations" ,
319+ "module" : "viz.sorting" ,
320+ "path" : "flask_app/visualizations/sorting_viz.py" ,
321+ },
322+ {
323+ "id" : "viz.graph" ,
324+ "title" : "Graph Traversal (BFS/DFS)" ,
325+ "category" : "visualizations" ,
326+ "module" : "viz.graph" ,
327+ "path" : "flask_app/visualizations/graph_viz.py" ,
328+ },
329+ {
330+ "id" : "viz.path" ,
331+ "title" : "Pathfinding (A*/Dijkstra/BFS/GBFS)" ,
332+ "category" : "visualizations" ,
333+ "module" : "viz.path" ,
334+ "path" : "flask_app/visualizations/path_viz.py" ,
335+ },
336+ {
337+ "id" : "viz.arrays" ,
338+ "title" : "Array Techniques" ,
339+ "category" : "visualizations" ,
340+ "module" : "viz.arrays" ,
341+ "path" : "flask_app/visualizations/array_viz.py" ,
342+ },
343+ {
344+ "id" : "viz.mst" ,
345+ "title" : "Minimum Spanning Tree (Kruskal/Prim)" ,
346+ "category" : "visualizations" ,
347+ "module" : "viz.mst" ,
348+ "path" : "flask_app/visualizations/mst_viz.py" ,
349+ },
350+ {
351+ "id" : "viz.topo" ,
352+ "title" : "Topological Sort (Kahn)" ,
353+ "category" : "visualizations" ,
354+ "module" : "viz.topo" ,
355+ "path" : "flask_app/visualizations/topo_viz.py" ,
356+ },
357+ {
358+ "id" : "viz.nn" ,
359+ "title" : "Neural Network (MLP Classifier)" ,
360+ "category" : "visualizations" ,
361+ "module" : "viz.nn" ,
362+ "path" : "flask_app/visualizations/nn_viz.py" ,
363+ },
321364 ]
322365 categories ["visualizations" ].extend (visualizations )
323366
0 commit comments