Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
hypha
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
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
ots
hypha
Commits
48a06088
Commit
48a06088
authored
6 years ago
by
Todd Dembrey
Browse files
Options
Downloads
Patches
Plain Diff
Tidy up the population of the review list preventing duplication
parent
6b04c7d3
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
opentech/apply/review/templates/review/review_list.html
+3
-3
3 additions, 3 deletions
opentech/apply/review/templates/review/review_list.html
opentech/apply/review/views.py
+15
-12
15 additions, 12 deletions
opentech/apply/review/views.py
with
18 additions
and
15 deletions
opentech/apply/review/templates/review/review_list.html
+
3
−
3
View file @
48a06088
...
...
@@ -21,10 +21,10 @@
</div>
<div
class=
"wrapper wrapper--reviews-table js-reviews-table"
>
<table
class=
"reviews-list"
>
{% for
question,
answers in review_data.
item
s %}
{% for answers in review_data.
value
s %}
<tr
class=
"reviews-list__tr"
>
<th
class=
"reviews-list__th"
>
{{ question }}
</th>
{% for answer in answers %}
<th
class=
"reviews-list__th"
>
{{
answers.
question }}
</th>
{% for answer in answers
.answers
%}
<td
class=
"reviews-list__td"
>
{{ answer|bleach }}
</td>
{% endfor %}
</tr>
...
...
This diff is collapsed.
Click to expand it.
opentech/apply/review/views.py
+
15
−
12
View file @
48a06088
...
...
@@ -124,26 +124,29 @@ class ReviewListView(ListView):
def
get_context_data
(
self
,
**
kwargs
):
review_data
=
{}
# Add the header rows
review_data
[
'
title
'
]
=
{
'
question
'
:
''
,
'
answers
'
:
list
()}
review_data
[
'
score
'
]
=
{
'
question
'
:
'
Overall Score
'
,
'
answers
'
:
list
()}
review_data
[
'
recommendation
'
]
=
{
'
question
'
:
'
Recommendation
'
,
'
answers
'
:
list
()}
for
review
in
self
.
object_list
:
# Add the name header row
review_data
.
setdefault
(
''
,
[]).
append
(
str
(
review
.
author
))
review_data
.
setdefault
(
'
Score
'
,
[]).
append
(
str
(
review
.
score
))
review_data
.
setdefault
(
'
Recommendation
'
,
[]).
append
(
review
.
get_recommendation_display
())
review_data
[
'
title
'
][
'
answers
'
].
append
(
str
(
review
.
author
))
review_data
[
'
score
'
][
'
answers
'
].
append
(
str
(
review
.
score
))
review_data
[
'
recommendation
'
][
'
answers
'
].
append
(
review
.
get_recommendation_display
())
for
data
,
field
in
review
.
data_and_fields
():
if
not
isinstance
(
field
.
block
,
RecommendationBlock
):
title
=
field
.
value
[
'
field_label
'
]
review_data
.
setdefault
(
title
,
[]
)
question
=
field
.
value
[
'
field_label
'
]
review_data
.
setdefault
(
field
.
id
,
{
'
question
'
:
question
,
'
answers
'
:
list
()}
)
if
isinstance
(
field
.
block
,
ScoreFieldBlock
):
value
=
json
.
loads
(
data
)
review_data
.
setdefault
(
title
,
[]).
append
(
str
(
value
[
0
]))
review_data
.
setdefault
(
f
'
Rate
{
title
}
'
,
[])
rating
=
int
(
value
[
1
])
review_data
.
setdefault
(
f
'
Rate
{
title
}
'
,
[]).
append
(
RATE_CHOICES_DICT
.
get
(
rating
,
RATE_CHOICE_NA
))
rating_value
=
int
(
value
[
1
])
rating
=
RATE_CHOICES_DICT
.
get
(
rating_value
,
RATE_CHOICE_NA
)
comment
=
str
(
value
[
0
])
review_data
[
field
.
id
][
'
answers
'
].
append
(
rating
+
comment
)
else
:
review_data
.
setdefault
(
title
,
[])
.
append
(
str
(
data
))
review_data
[
field
.
id
][
'
answers
'
]
.
append
(
str
(
data
))
return
super
().
get_context_data
(
submission
=
self
.
submission
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment