Skip to content
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

Open
wants to merge 61 commits into
base: main
Choose a base branch
from

Conversation

jooooosef
Copy link
Collaborator

@jooooosef jooooosef commented Jun 24, 2024

fix #1786

@jooooosef jooooosef marked this pull request as draft June 24, 2024 20:49
@jooooosef jooooosef changed the title Customizable evaluation results filters #1786 Customizable evaluation results filters Jun 24, 2024
@ybrnr ybrnr force-pushed the iss1786 branch 4 times, most recently from 0127464 to ca11745 Compare July 8, 2024 15:48
Copy link
Member

@janno42 janno42 left a 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

@richardebeling richardebeling changed the title Customizable evaluation results filters Customizable evaluation results filters Oct 14, 2024
@ybrnr ybrnr force-pushed the iss1786 branch 2 times, most recently from 9bd5cea to 8aaee00 Compare October 21, 2024 16:22
@ybrnr ybrnr force-pushed the iss1786 branch 2 times, most recently from e77a156 to 73c3a65 Compare October 28, 2024 22:50
@jooooosef jooooosef marked this pull request as ready for review November 18, 2024 22:04
jooooosef and others added 2 commits December 16, 2024 22:19
implemented smaller changes that were quested in PR.
- removed comments
- itereated over enums directly
- changed the name in this itereation from con_view to contributor_view (same for gen_view)
- correclty formatted HTML comment
- made things that should be in one line to be in one line
- implemented variables for reused expected answers (on method and instance level) in test_views.py

Co-authored-by: Yannik <[email protected]>
showing a tooltip with title is not possible since the tag has the disabled class and therefore does not accept any mouse events.
Also: formatted code.

Co-authored-by: Yannik <[email protected]>
Copy link
Collaborator

@Kakadus Kakadus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

some last comments from me :)

jooooosef and others added 5 commits January 6, 2025 20:41
Removed tooltip from individual buttons and added a big one on label of the results button groups, since it is not simply possible to show a tooltip on a disabled button.

Co-authored-by: Yannik <[email protected]>
Test seems to be deleted by accident.
Added it again.
should (maybe?) be a lil faster. But was recommend so here.
This uses the db to check if one of the represented users is a responsible.
Copy link
Member

@janno42 janno42 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This nice, want have.
(After changing these little things)

@jooooosef
Copy link
Collaborator Author

jooooosef commented Jan 13, 2025

I just realised that when I use the contributor and go in a contribution where I dont have general_textanswers rights but can edit change the contributor settings that the value for the view_general_results parameter is not set correctly.
Example:
user: [email protected]
contribution: Operating Systems I
click on ratings

Why is that? @janno42

removed tooltips and changed some labels
@janno42
Copy link
Member

janno42 commented Jan 20, 2025

I just realised that when I use the contributor and go in a contribution where I dont have general_textanswers rights but can edit change the contributor settings that the value for the view_general_results parameter is not set correctly. Example: user: [email protected] contribution: Operating Systems I click on ratings

Why is that? @janno42

Probably because you don't set the value and in evaluation_detail_parse_get_parameters the default is FULL?

Copy link
Member

@niklasmohrin niklasmohrin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks mostly good

@e-valuation e-valuation deleted a comment from jooooosef Feb 10, 2025
jooooosef and others added 5 commits February 17, 2025 18:17
name was "general" even though it tests contributor
changed some code to be more clear and used better naming
Copy link
Member

@niklasmohrin niklasmohrin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, very cool!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we should try to make the columns align to make it look nicer, what do you think @janno42 ?

This is the current site:
image

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We discussed that and both alignments have their disadvantages. I originally also thought right-aligned might look better, so yes, let's move them :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, but do you mean to keep the width of all elements the same, but move the top row to right? I thought that we would make the right border of "general results" and "contributor results" align, and then have the two "ratings and texts" buttons and the two "ratings" buttons be vertically aligned (with no button over "only mine").

In the end, I don't really care about which version we use

This comment was marked as duplicate.

Copy link
Member

@richardebeling richardebeling left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looking really good! I have a few more comments, but we can also address those in a follow-up PR if you prefer :)

".responsible_contributor_additional_orig_deleted.",
]

standard_general_textanswers = [ # subset of general_textanswers
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like this is intended to be "set of textanswers that are visible to everyone who can see textanswers"? If yes, I'd suggest to name/comment like that.

def test_manager(self):
user = self.manager
self.check_with_view(user, [])
with run_in_staff_mode(self): # in staff mode, the manager can see everything except deleted or changed
Copy link
Member

@richardebeling richardebeling Mar 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comment doesn't match assertion below, we assert that everything from self.standard_general_textanswers is visible, which includes general_changed_published.

I would, without checking more deeply, expect that noone can ever see deleted or the originals of changed answers? In that case, I would also try to generalize that out, so that the logic here doesn't have to list any answers at all, but literally just says: "As a manager, I can see all comments that could possibly be shown to any user".

expected_visible_textanswers,
general=ViewGeneralResults,
contributor=ViewContributorResults,
all_textanswers=general_textanswers + contributor_textanswers,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quick Ctrl+F says all_textanswers is never passed?

Comment on lines +218 to +225
user_represents_general_visibilty_contributor = any(
evaluation.is_user_contributor(user)
and evaluation.contributions.filter(
contributor=user,
textanswer_visibility=Contribution.TextAnswerVisibility.GENERAL_TEXTANSWERS,
).exists()
for user in represented_users
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Semantically correct and nice code, but: We also need to worry about performance here. is_user_contributor hits the database once, the .exists() query hits the database once, all of this happens n times for n represented users. Can we maybe express this as a single queryset instead?

(same thing applies to the other queries above as well)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Customizable evaluation results filters
6 participants