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

quality assurance updates #772

Merged
merged 8 commits into from
Dec 20, 2020
Merged

Conversation

dodumosu
Copy link
Collaborator

this PR contains the following changes to how Apollo works:

  • invalid QA for any reason (badly formed expressions, multiple choice fields used, invalid question codes used) will always evaluate to Missing
  • the user entering QA is prompted with a message when there is an issue with entered QA, even though it is saved

Screenshot_2020-11-12 Forms - Apollo(3)
Screenshot_2020-11-12 Forms - Apollo(4)

@dodumosu dodumosu requested a review from takinbo November 12, 2020 12:25
@dodumosu dodumosu marked this pull request as draft November 12, 2020 12:25
@dodumosu dodumosu marked this pull request as ready for review December 2, 2020 16:12
Copy link
Collaborator

@takinbo takinbo left a comment

Choose a reason for hiding this comment

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

This PR should be simplified. Rather than display a modal with an error, we should rather not return any question codes that are multiple choice, image, location or comment fields. If a QA expression for some reason contains any of these, then it should return the no data state and not attempt to compute the QA status.

apollo/formsframework/views_forms.py Outdated Show resolved Hide resolved
apollo/templates/admin/quality_assurance.html Outdated Show resolved Hide resolved
apollo/templates/admin/quality_assurance_edit.html Outdated Show resolved Hide resolved
apollo/submissions/qa/messages.py Outdated Show resolved Hide resolved
Comment on lines 313 to 335
# sanity check
expression = build_expression(quality_control)
if expression == '':
errors.add(FlagCause.EMPTY_EXPRESSION)
else:
try:
parse_tree = parser.parse(expression)
invalid_tags, multiselect_tags = verify_expression(
form, parse_tree)

if invalid_tags:
errors.add(FlagCause.MISSING_VARIABLE)

if multiselect_tags:
errors.add(FlagCause.MULTISELECT_VARIABLE)
except NoMatch:
errors.add(FlagCause.MALFORMED_EXPRESSION)

# the invalid tags and multi-select tags are returned
# as sets
invalid_tags = list(invalid_tags)
multiselect_tags = list(multiselect_tags)

Copy link
Collaborator

Choose a reason for hiding this comment

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

This will probably also need clean up considering we're not using those errors anymore?

Comment on lines 5 to 9
class FlagCause(enum.IntEnum):
EMPTY_EXPRESSION = 1
MALFORMED_EXPRESSION = 2
MISSING_VARIABLE = 3
MULTISELECT_VARIABLE = 4
Copy link
Collaborator

Choose a reason for hiding this comment

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

If we're not returning any errors in the QA builder, do we still need this?

Copy link
Collaborator

@takinbo takinbo left a comment

Choose a reason for hiding this comment

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

A few extraneous unused lines and this PR should be good for merging

@@ -155,6 +158,12 @@ def __init__(self, defaults=True, **kwargs):
def visit_variable(self, node, children):
var_name = node.value
if var_name not in self.form.tags:
self.invalid_variables.add(var_name)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is there a current usecase for these?


field = self.form.get_field_by_tag(var_name)
if field['type'] == 'multiselect':
self.multiple_choice_variables.add(var_name)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same.

@@ -212,12 +221,19 @@ def visit_variable(self, node, children):
self.variables.add(var_name)
if var_name not in self.form.tags:
self.lock_null = True
self.invalid_variables.add(var_name)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same.


if field['type'] == 'multiselect':
self.lock_null = True
self.multiple_choice_variables.add(var_name)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same.

@dodumosu dodumosu force-pushed the issues-97-99-qa-updates branch from 0e956f4 to a2729c0 Compare December 13, 2020 03:04
@dodumosu dodumosu force-pushed the issues-97-99-qa-updates branch from a2729c0 to 4c56a1d Compare December 13, 2020 15:46
Copy link
Collaborator

@takinbo takinbo left a comment

Choose a reason for hiding this comment

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

Could you please test this and confirm it's working? I applied the PR to a working system and all the questions are no longer visible in the QA builder.

@dodumosu
Copy link
Collaborator Author

dodumosu commented Dec 16, 2020

i'm unable to replicate the issue you have had. perhaps you could send a dump of your database? the screenshots below are also from a replicate of a working system

firefox_vxpJAEzwTe
firefox_mn1759ZcCT
firefox_cm0K9qMnrL
C3Qw7xojxz

Copy link
Collaborator

@takinbo takinbo left a comment

Choose a reason for hiding this comment

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

tACK

@takinbo takinbo merged commit 3b2b592 into nditech:develop Dec 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants