Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
NTNU_reflect
Manage
Activity
Members
Labels
Plan
Issues
5
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Thomas Nitsche
NTNU_reflect
Merge requests
!39
Resolve "CATEGORIZE_FEEDBACK"
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Resolve "CATEGORIZE_FEEDBACK"
17-categorize_feedback
into
ref_copy
Overview
1
Commits
7
Pipelines
0
Changes
3
Merged
Helena Dypvik Skants
requested to merge
17-categorize_feedback
into
ref_copy
1 year ago
Overview
1
Commits
7
Pipelines
0
Changes
3
Expand
Closes
#17 (closed)
0
0
Merge request reports
Compare
ref_copy
ref_copy (base)
and
latest version
latest version
2e75ed73
7 commits,
1 year ago
3 files
+
156
−
20
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
3
Search (e.g. *.vue) (Ctrl+P)
frontend/src/routes/app/courseview/[course]/[unit]/reflections/+page.svelte
0 → 100644
+
58
−
0
Options
<script
lang=
"ts"
>
import
type
{
ActionData
,
PageData
}
from
'
./$types
'
;
import
{
Button
}
from
'
flowbite-svelte
'
;
export
let
data
:
PageData
;
let
answers
=
data
.
units
.
filter
((
unit
)
=>
(
unit
.
id
=
data
.
unit_id
))
.
flatMap
((
unit
)
=>
unit
.
reflections
);
let
filename
:
string
=
'
reflections.txt
'
;
// Gjør om listen med svar om til en streng!
let
content
=
answers
.
toString
();
function
downloadFile
(
filename
:
string
,
content
:
string
)
{
const
element
=
document
.
createElement
(
'
a
'
);
const
fileContent
=
data
.
questions
.
map
((
question
:
{
id
:
number
;
comment
:
any
})
=>
{
const
answer
=
answers
.
find
((
a
)
=>
a
.
question_id
===
question
.
id
)?.
body
||
''
;
return
`
${
question
.
comment
}
\n -
${
answer
}
\n`
;
})
.
join
(
'
\n
'
);
const
blob
=
new
Blob
([
fileContent
],
{
type
:
'
plain/text
'
});
const
fileUrl
=
URL
.
createObjectURL
(
blob
);
element
.
setAttribute
(
'
href
'
,
fileUrl
);
element
.
setAttribute
(
'
download
'
,
filename
);
element
.
style
.
display
=
'
none
'
;
document
.
body
.
appendChild
(
element
);
element
.
click
();
document
.
body
.
removeChild
(
element
);
}
</script>
<!-- denne klarer ikkek finne action -->
<form
class=
"button-container my-8 justify-center align-middle"
>
<span
class=
"text-primary mx-8 text-xl font-bold"
>
Reflections on
{
data
.
course
.
id
}
, unit
{
data
.
unit_id
}
</span
>
<p
class=
"mx-8 my-8 mb-4 flex max-w-2xl flex-col gap-y-4"
>
{
#each
data
.
questions
as
question
}
<label
for=
"reflection"
>
{
question
.
comment
}
</label>
<textarea
id=
"reflection"
disabled=
{
true
}
rows=
"5"
value=
{
answers
.
filter
((
answer
)
=>
answer
.
question_id
===
question
.
id
)[
0
]?.
body
||
''
}
/>
{
/each
}
</p>
<div
class=
"flex"
>
<Button
on:click=
{
()
=>
downloadFile
(
filename
,
content
)
}
id=
"download"
type=
"submit"
class=
"bg-teal-9 hover:bg-teal-8 ml-8 mt-[20px] h-10 w-36"
>
Download report
</Button
>
</div>
</form>
Loading