-
Notifications
You must be signed in to change notification settings - Fork 147
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Customizable evaluation results filters #2232
base: main
Are you sure you want to change the base?
Conversation
0127464
to
ca11745
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- looks good, most parts work as expected
- tests not reviewed yet
@@ -567,24 +582,6 @@ def test_invalid_contributor_id(self): | |||
self.app.get(self.url + "?contributor_id=asd", user=self.manager, status=400) | |||
self.app.get(self.url + "?contributor_id=1234", user=self.manager, status=404) | |||
|
|||
def test_evaluation_sorting(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why was this removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that was an accident I added it again
9bd5cea
to
8aaee00
Compare
e77a156
to
73c3a65
Compare
…py müssen wir uns nochmal anschauen, da failed noch ein test
…est_tools zusammengeführt, jetzt alles clean
…aber jetzt geht wieder
…tor and responsible test classes
…ack on what problem we are working atm
made the can_see_general_textanswers and the contributor counterpart also consider the represtened users
make difference between remove_textanswers_that_the_user_must_not_see and can_textanswer_be_seen_by clearer for the future
when users cannot or should not click specific textanswer buttons (because it does not make sense) they should still be there for consistency but should be disabled
@@ -21,7 +21,7 @@ | |||
{% if evaluation.state != evaluation.State.PUBLISHED %} | |||
<div class="alert alert-warning">{% translate 'This is a preview. The results have not been published yet.' %}</div> | |||
{% endif %} | |||
|
|||
<!--manager is automatically a reviewer (so this are all groups that can see the buttons)--> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<!--manager is automatically a reviewer (so this are all groups that can see the buttons)--> | |
{# manager is automatically a reviewer (so this are all groups that can see the buttons) #} |
so this is not part of the rendered output
def test_default_view( | ||
self, | ||
): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def test_default_view( | |
self, | |
): | |
def test_default_view(self): |
self.assertNotIn(".responsible_contributor_orig_notreviewed.", page) | ||
self.assertIn(".responsible_contributor_additional_orig_published.", page) | ||
self.assertNotIn(".responsible_contributor_additional_orig_hidden.", page) | ||
def helper_test_general(self, user, view_general_results, textanswers_in): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Regarding textanswers_in
: What do you think about expected_visible_textanswers
? (Repeated below)
user = "[email protected]" | ||
|
||
self.helper_test_general( | ||
user, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should always be able to just use self.student
, self.manager
, .... This allows someone reading the code to not need to keep context in memory, all lines are verifiable in isolation.
user = "[email protected]" | |
self.helper_test_general( | |
user, | |
self.helper_test_general( | |
self.manager, |
".responsible_contributor_orig_published.", | ||
".responsible_contributor_changed_published.", | ||
".responsible_contributor_orig_private.", | ||
".responsible_contributor_additional_orig_published.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can put this block of 4 expected answers and the block above of 3 expected answers into some well-named variable, which reduced duplication and makes the test easier to read through.
if view_general_results == ViewGeneralResults.RATINGS: | ||
return False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this branch and the corresponding final else branch, can both be removed.
@@ -199,6 +209,30 @@ def evaluation_detail(request, semester_id, evaluation_id): | |||
|
|||
is_responsible_or_contributor_or_delegate = evaluation.is_user_responsible_or_contributor_or_delegate(view_as_user) | |||
|
|||
general_textanswers = False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is all this new code here necessary now, which part of this is is not covered by the access computation methods above?
request.GET.get( | ||
"view_contributor_results", | ||
ViewContributorResults.FULL, | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think these hit the 120 columns limit, do they?
request.GET.get( | |
"view_contributor_results", | |
ViewContributorResults.FULL, | |
) | |
request.GET.get("view_contributor_results", ViewContributorResults.FULL) |
# redirect to non-public view if there is none because the results have not been published | ||
if not evaluation.can_publish_rating_results and view == "public": | ||
view = "full" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this no longer needed?
@@ -101,7 +101,7 @@ <h5 class="card-title me-auto">{% translate 'Export evaluation results' %}</h5> | |||
{% for evaluation in semester_evaluations.list %} | |||
<li> | |||
{% if evaluation|can_results_page_be_seen_by:form.instance %} | |||
<a href="{% url 'results:evaluation_detail' semester_evaluations.grouper.id evaluation.id %}?view=export&contributor_id={{ form.instance.id }}"> | |||
<a href="{% url 'results:evaluation_detail' semester_evaluations.grouper.id evaluation.id %}?view_contributor_results=personal&contributor_id={{ form.instance.id }}"> | |||
{{ evaluation.full_name }} | |||
</a> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
random line of code: You updated the bootstrap submodule. Was this intentional / required for anything? If not, please revert.
class ViewGeneralResults(Enum): | ||
@property | ||
def do_not_call_in_templates(self): | ||
return False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return False | |
return True |
@@ -473,49 +493,54 @@ def textanswers_visible_to(contribution): | |||
return TextAnswerVisibility(visible_by_contribution=sorted_contributors, visible_by_delegation_count=num_delegates) | |||
|
|||
|
|||
def can_textanswer_be_seen_by( # noqa: PLR0911 | |||
# Filter textanswers based on user selection |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# Filter textanswers based on user selection |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably not needed
if view_general_results == ViewGeneralResults.RATINGS: | ||
return False | ||
if view_general_results == ViewGeneralResults.FULL: | ||
# reviewer can see everything |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# reviewer can see everything |
if Contribution.objects.filter( | ||
contributor=user, | ||
evaluation=evaluation, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if Contribution.objects.filter( | |
contributor=user, | |
evaluation=evaluation, | |
if evaluation.contributions.filter( | |
contributor=user, |
contributor_views = [ViewContributorResults.FULL, ViewContributorResults.RATINGS, ViewContributorResults.PERSONAL] | ||
general_views = [ViewGeneralResults.FULL, ViewGeneralResults.RATINGS] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you don't need these, you can iterate over the enums
for con_view in self.contributor_views: | ||
page = self.app.get( | ||
f"/results/semester/1/evaluation/1?view_general_results={view_general_results.value}&view_contributor_results={con_view.value}", | ||
user=user, | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for con_view in self.contributor_views: | |
page = self.app.get( | |
f"/results/semester/1/evaluation/1?view_general_results={view_general_results.value}&view_contributor_results={con_view.value}", | |
user=user, | |
) | |
for contributor_view in self.contributor_views: | |
page = self.app.get( | |
f"/results/semester/1/evaluation/1?view_general_results={view_general_results.value}&view_contributor_results={contributor_view.value}", | |
user=user, | |
) |
for gen_view in self.general_views: | ||
page = self.app.get( | ||
f"/results/semester/1/evaluation/1?view_contributor_results={view_contributor_results.value}&view_general_results={gen_view.value}", | ||
user=user, | ||
) | ||
|
||
for answer in textanswers_in: | ||
self.assertIn(answer, page) | ||
for answer in textanswers_not_in: | ||
self.assertNotIn(answer, page) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for gen_view in self.general_views: | |
page = self.app.get( | |
f"/results/semester/1/evaluation/1?view_contributor_results={view_contributor_results.value}&view_general_results={gen_view.value}", | |
user=user, | |
) | |
for answer in textanswers_in: | |
self.assertIn(answer, page) | |
for answer in textanswers_not_in: | |
self.assertNotIn(answer, page) | |
for general_view in self.general_views: | |
page = self.app.get( | |
f"/results/semester/1/evaluation/1?view_contributor_results={view_contributor_results.value}&view_general_results={general_view.value}", | |
user=user, | |
) | |
for answer in textanswers_in: | |
self.assertIn(answer, page) | |
for answer in textanswers_not_in: | |
self.assertNotIn(answer, page) |
<div class="row"> | ||
<div class="col-auto"> | ||
<div class="btn-switch btn-switch-light my-auto d-print-none"> | ||
<div class="btn-switch-label">{% translate 'General results' %}</div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
when disabled, "Ratings" should be selected/active and its tooltip should be shown on hover.
a different tooltip should be shown for "All" when disabled: "You can't see text answers for general questions in this evaluation."
<div class="row mt-1"> | ||
<div class="col-auto"> | ||
<div class="btn-switch btn-switch-light my-auto d-print-none"> | ||
<div class="btn-switch-label">{% translate 'Contributor results' %}</div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
when disabled, "Ratings" should be selected/active and its tooltip should be shown on hover.
a different tooltip should be shown for the other buttons when disabled: "You can't see text answers for contributor questions because you aren't a contributor."
fix #1786