From 6145e18d9ddcba03d6c57d65d3b6aff1d2156a64 Mon Sep 17 00:00:00 2001
From: olima957 <olima957@student.liu.se>
Date: Thu, 3 Oct 2024 23:00:18 +0200
Subject: [PATCH] get_technique_stats uppdaterad.

---
 MyPortfolio/data.py | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/MyPortfolio/data.py b/MyPortfolio/data.py
index c386d5e..4579271 100644
--- a/MyPortfolio/data.py
+++ b/MyPortfolio/data.py
@@ -78,17 +78,17 @@ def get_technique_stats(data):
 
     technique_list = get_techniques(data)
     technique_stats = {}
+    current_techniques = []
 
-    for project in data:
-        for technique in technique_list:
+    for technique in technique_list:
+        for project in data:
             if technique in project['techniques_used']:
-                buffer = [{'id' : project['project_id'], 'name' : project['project_name']}]
-                technique_stats.update({technique : buffer})
-                
-            
-    
-                
-    pprint.pp(technique_stats)
+                current_techniques.append({'id' : project['project_id'], 'name' : project['project_name']})
+
+        technique_stats.update({technique : current_techniques.copy()})
+        current_techniques.clear()
+
+
     return technique_stats
 
 
-- 
GitLab