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

Fix capa report generation issue #264

Merged
merged 3 commits into from
Jun 3, 2021

Conversation

HamzaIbnFarooq
Copy link

@HamzaIbnFarooq HamzaIbnFarooq commented May 28, 2021

Description

Fixes Capa questions report generation issues by providing a default value for the problems having no text values for answer options.

Related Issues

#262
#239

How to test?

Test 1:

Generate the issue without this branch's fix:

  1. Create a Checkbox Problem on studio
  2. Don't put any text against one of the options
    image
  3. Through LMS select that option with no text
  4. Go to Data Download under Instructor tab
  5. Under the Reports section, select the Problem and press Create a report of problem responses
    The error will be generated.

Now use this branch and try downloading the report again, it should be fixed now.

Test 2:

Generate the issue without this branch's fix:

  1. Create a checkboxes problem
  2. Add N options under that problem (where N is a number)
  3. Go to LMS, select and submit Nth option
  4. Go back to the studio and update the question by removing the Nth option (now the total options will be N-1)
  5. Try generating a response report for that problem, it will give Error: There was an error generating your report. error.

Now use this branch and try downloading the report again, it should be fixed now.

blarghmatey and others added 2 commits May 28, 2021 12:44
In the current state if it is unable to find the answer text for a given response (maybe because it was skipped?) then the report will fail to generate. Adding in a conditional with placeholder text allows the report to generate rather than completely failing to provide this data to the course instructor.
Copy link

@ziafazal ziafazal left a comment

Choose a reason for hiding this comment

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

@HamzaIbnFarooq completed first round of review. I'd recommend you add units tests too so we can have a single upstream PR.

@@ -657,7 +657,8 @@ def find_answer_text(self, answer_id, current_answer):
if isinstance(current_answer, list):
# Multiple answers. This case happens e.g. in multiple choice problems
answer_text = ", ".join(
self.find_answer_text(answer_id, answer) for answer in current_answer
self.find_answer_text(answer_id, answer) or 'No Answer Recorded'

Choose a reason for hiding this comment

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

we should add logic in find_answer_text to check if there is no text for answered choice it should return Answer Text Missing.

Copy link
Author

Choose a reason for hiding this comment

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

Updated.

input_cls = inputtypes.registry.get_class_for_tag(choicegroup.tag)
choices_map = dict(input_cls.extract_choices(choicegroup, self.capa_system.i18n, text_only=True))
answer_text = choices_map[current_answer]
if len(elems) == 1:

Choose a reason for hiding this comment

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

we need to check all cases

  1. we have not choice found
  2. we have 1 choice
  3. we have more than 1 choices found
if len(elems) == 0:
     log.warning("Answer Text Missing for answer id: %s and choice number: %s", answer_id, current_answer)
    answer_text = 'Answer Text Missing'
elif  len(elems) == 0:
    {current implementation}
else
    log.warning("Multiple answers found for answer id: %s and choice number: %s", answer_id, current_answer)
    answer_text = 'Multiple answers found'

Copy link
Author

Choose a reason for hiding this comment

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

Updated.

@HamzaIbnFarooq
Copy link
Author

I'd recommend you add units tests too so we can have a single upstream PR.

@ziafazal we are not planning this PR to be an upstream one, we will be using this locally right now. We will be creating an upstream of #265 only, once that gets reviewed.

@HamzaIbnFarooq
Copy link
Author

@pdpinch Do you think we should create an upstream PR of fixing old data for capa reports generation and add markdown validation in capa problems combined
OR
stick with the original plan as mentioned here saying that only add markdown validation in capa problems should be upstream.

@pdpinch
Copy link
Member

pdpinch commented Jun 1, 2021 via email

Copy link

@ziafazal ziafazal left a comment

Choose a reason for hiding this comment

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

👍

@HamzaIbnFarooq
Copy link
Author

My first priority is to get the Residential MITx teams access to their data, but yes we should plan on upstreaming both of these fixes to edx master.

@pdpinch you can have a look at the current PR, if it seems good to you then we can merge it right away. I can cherry-pick the commits to create an upstream PR and add some tests afterwards.

@pdpinch
Copy link
Member

pdpinch commented Jun 2, 2021

@mitodl/devops can we try deploying this change to lms.mitx.mit.edu to see if it helps address ZenDesk 96001

@blarghmatey
Copy link
Member

Once it's merged we can run a build to get this through to production. Code looks good to me 👍

@HamzaIbnFarooq HamzaIbnFarooq merged this pull request into mitx/koa Jun 3, 2021
@HamzaIbnFarooq HamzaIbnFarooq self-assigned this Jun 3, 2021
@HamzaIbnFarooq
Copy link
Author

@blarghmatey the current branch's fix was removed from mitx/koa most probably due to a force push (maybe yesterday), so whenever it's feasible for you, can you push the commit back to mitx/koa to reflect the changes?

blarghmatey pushed a commit that referenced this pull request Jun 4, 2021
In the current state if CAPA problem response report generation is unable to find the answer text for a given response then the report will fail to generate. Adding a placeholder text allows the report to generate rather than completely failing to provide this data to the course instructor.

(cherry picked from commit e94801661a3b964276f7dcac331c39057a095797)
blarghmatey pushed a commit that referenced this pull request Sep 7, 2021
In the current state if CAPA problem response report generation is unable to find the answer text for a given response then the report will fail to generate. Adding a placeholder text allows the report to generate rather than completely failing to provide this data to the course instructor.

(cherry picked from commit e94801661a3b964276f7dcac331c39057a095797)
blarghmatey pushed a commit that referenced this pull request Sep 19, 2022
This PR adds MFE API. This is part of the work that is being done to obtain the MFE Runtime Configurations and that has been discussed in the BTR WG.

Discussion: https://discuss.openedx.org/t/how-to-use-microfrontend-in-a-multitenant-instance/6936/14?u=mafermazu
MFE Runtime configuration - eduNEXT: https://docs.google.com/document/d/1-FHIQmyeQZu3311x8eYUNMru4JX7Yb3UlqjmJxvM8do/edit?usp=sharing

feat: add lms setting to set mfe config cache (#262)

Co-authored-by: María Fernanda Magallanes Z <maria.magallanes@edunext.co>

feat: make mfe config api disabled by default (#263)

* feat: make mfe config api disabled by default

* fix: simple is better than complex

test: add mfe config tests (#264)

* test: add mfe config tests

* test: fix it and simplify it

* test: correct pylint issues

fix: correct pep 8 violations

fix: add mfe api unit test in github workflow

fix: correct unit tests

refactor: move mfe api to lms

fix: try mfe api urls without regex

fix: add app_namespace in lms urls

fix: try url without conditional

Revert "fix: try url without conditional"

This reverts commit 694aab546134b4bd9ad2642e24927b42cac24459.

fix: set enable_mfe_config_api feature to true in the tests

test: try to add failed test case

Revert "test: try to add failed test case"

This reverts commit cee6bf656ab1b96492b0b6199ddff32a6d6a65bd.

docs: improve explanation and documentation

fix: ensure the response is a json object

refactor: be consistent with the variable names

fix: allow overriding mfe api config cache timeout in production

fix: handle 404 response in view

refactor: use a guard instead if-else

feat: add the possibility to show mfe specific config
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.

4 participants