diff --git a/index.html b/index.html index a340c6b..b724957 100644 --- a/index.html +++ b/index.html @@ -1205,13 +1205,8 @@ renderProjectSelectorOptions() renderInternSelectorOptions() } - const { projectCode, internId, date } = params || getUpdateFilters() - if (params) { - setUpdateFilters({ projectCode, internId, date }) - } else if (projectCode) { - const dateParam = date !== '' ? `&date=${date}` : '' - history.replaceState(null, null, `#/updates_page?projectCode=${projectCode}&internId=${internId}${dateParam}`) - } + const { projectCode = 'all', internId = 'all', date } = params || {} + setUpdateFilters({ projectCode, internId, date }) let matchedUpdates if (projectCode !== 'all') { matchedUpdates = getUpdatesByProject(projectCode) @@ -2041,12 +2036,20 @@ } return assignedTasksList.length > 0 ? assignedTasksList : false }, - completedInternTasks(internId) { + completedInternTasks(internId, savedUpdates) { const { completedTasks } = RIBC.getInternRecord(internId) if (getObjLength(completedTasks) === 0) return false return Object.keys(completedTasks).map(task => { + const { link, description } = savedUpdates.get(task) || {} const { points, completionDate } = completedTasks[task]; const { title } = RIBC.getAllTasks()[task]; + const div = document.createElement('div') + div.innerHTML = DOMPurify.sanitize(linkify(link || description)) + const links = [...div.querySelectorAll('a')].map(link => { + link.textContent = 'See task output' + link.className = 'button button--small button--colored margin-right-auto' + return link + }) return html`

${title}

@@ -2055,6 +2058,7 @@ ${points}

+ ${links}
`}) }, adminTask(task) { @@ -2296,6 +2300,13 @@ if (splitName.length > 1) { initials += splitName[splitName.length - 1][0] } + const savedUpdates = new Map() + RIBC.getInternUpdates().map(update => { + const { tag, floID, update: { projectCode, branch, task, link, description } } = update + if (tag && floID === internFloId) { + savedUpdates.set(`${projectCode}_${branch}_${task}`, { link, description }) + } + }) renderElem(getRef('intern_profile'), html`
@@ -2354,7 +2365,7 @@

Completed

- ${render.completedInternTasks(internFloId) || html`

No tasks completed yet

`} + ${render.completedInternTasks(internFloId, savedUpdates) || html`

No tasks completed yet

`}