@@ -2,7 +2,6 @@ const projectListDiv_el = document.getElementById('projectListDiv');
22
33function populateRecentProjects ( ) {
44 console . log ( activeTopics ) ;
5- console . log ( activeProjects ) ;
65
76 activeProjects . forEach ( element => {
87 const projectItem_el = document . createElement ( 'div' ) ;
@@ -15,13 +14,26 @@ function populateRecentProjects(){
1514 projectTimeText_el . textContent = 'NA YET' ;
1615
1716 const projectTopicText_el = document . createElement ( 'h5' ) ;
18- projectTopicText_el . textContent = 'NA YET' ;
17+ const topicName = findTopicById ( element . topicID ) ;
18+ projectTopicText_el . textContent = topicName ;
19+
1920
2021 const projectSubtopicText_el = document . createElement ( 'h5' ) ;
21- projectSubtopicText_el . textContent = 'NA YET' ;
22+ const subtopicName = findSubtopicById ( element . subtopicID ) ;
23+ projectSubtopicText_el . textContent = subtopicName ;
2224
2325 projectItem_el . append ( projectName_el , projectTimeText_el , projectTopicText_el , projectSubtopicText_el ) ;
2426
2527 projectListDiv_el . append ( projectItem_el ) ;
2628 } ) ;
29+ }
30+
31+ function findTopicById ( id ) {
32+ const foundObject = activeTopics . find ( obj => obj . id === id ) ;
33+ return foundObject ? foundObject . topic : null ;
34+ }
35+
36+ function findSubtopicById ( id ) {
37+ const foundObject = activeSubtopics . find ( obj => obj . id === id ) ;
38+ return foundObject ? foundObject . subtopic : null ;
2739}
0 commit comments