Skip to content

Questionnaire: deletion area (Recycle bin) for deleted/orphaned questions#401

Closed
hatuanem199801 wants to merge 2 commits intoPoetOS:MOODLE_404_STABLEfrom
NashTechOpenUniversity:wip253248
Closed

Questionnaire: deletion area (Recycle bin) for deleted/orphaned questions#401
hatuanem199801 wants to merge 2 commits intoPoetOS:MOODLE_404_STABLEfrom
NashTechOpenUniversity:wip253248

Conversation

@hatuanem199801
Copy link
Copy Markdown

We have to create a new feature the deletion question in mod questionnaire.
Please review this commit and inform for any issues.
Thanks.

@mchurchward
Copy link
Copy Markdown
Contributor

I apologize for the long delay in responding to this. This is an interesting idea. Does this utilize any of the core recycle bin functions?

@emhat098
Copy link
Copy Markdown

emhat098 commented Feb 6, 2023

No, it doesn't. We are using the cron task functions to delete the question at the moment.

@toanlamt toanlamt force-pushed the wip253248 branch 5 times, most recently from 5590d50 to a5d3e3c Compare June 5, 2024 10:35
@tailetan tailetan force-pushed the wip253248 branch 3 times, most recently from 0735b93 to a2c6142 Compare June 17, 2024 08:21
@tailetan
Copy link
Copy Markdown
Contributor

This commit is rebased with MOODLE_401_STABLE
cc: @mchurchward

@mchurchward
Copy link
Copy Markdown
Contributor

Hi. This needs another rebasing, and conflict resolution.

@tailetan
Copy link
Copy Markdown
Contributor

I have just rebased with MOODLE_401_STABLE
cc: @mchurchward

@mchurchward mchurchward changed the base branch from MOODLE_310_STABLE to MOODLE_401_STABLE August 27, 2024 15:49
@mchurchward
Copy link
Copy Markdown
Contributor

Sorry. The latest branch is the MOODLE_404_STABLE branch. This needs to be rebased against it. I am still trying to understand this. Is the goal to remove questions entirely from the database? In which case, I am not sure that a question that has been flagged as deleted can currently ever be recovered. It may make more sense to simply remove the question at deletion time. Unless there is somewhere that a question can be recovered?

@tailetan tailetan force-pushed the wip253248 branch 2 times, most recently from 3cadb7b to c36b66c Compare June 6, 2025 05:17
@mchurchward mchurchward changed the base branch from MOODLE_401_STABLE to MOODLE_404_STABLE June 6, 2025 14:19
@mchurchward
Copy link
Copy Markdown
Contributor

I still need to understand the workflow of this feature. At present, as far as I know, when a question is deleted, there is no way to actually recover it. It just gets tagged as deleted. Since there is no way to recover it, perhaps it should just be removed from the database at that time. Unless this feature is actually adding a function to recover it?

@tailetan
Copy link
Copy Markdown
Contributor

tailetan commented Jun 9, 2025

Hi @mchurchward , I would like to share the ideal workflow for this request as below:

  1. When a user creates a question, it appears in the Manage questions section.
  2. If the user deletes the question, a confirmation pop-up will appear stating that the question will be moved to the Question Deletion Area.
  3. If the user clicks "Yes," the question is moved to the Question Deletion Area located below the Manage questions section.
  4. Each deleted question will display a message indicating when it will be permanently deleted.
    For example: Each question in the Deletion Area displays a label:
    "Time of permanent deletion: night of "
    (This time is calculated as: the moment it was moved to the deletion area + the number of days configured in the admin setting. Default: 7 days.)
    Eg:
  • Moved to deletion area: 30 March 2023
  • Admin setting: keep for 7 days
  • Time of permanent deletion: night of Wed 06 April 2023
    There are three possible outcomes from this point:
  1. If the user clicks the X button on the question in the Question Deletion Area, a confirmation pop-up will appear. Clicking "Yes" will permanently delete the question from the system, while clicking "No" will cancel the action.
  2. If the user wants to keep the question, they can click the Restore button (arrow icon). The question will then be restored to its original position in the Manage questions section.
  3. If the user takes no action, the question will remain in the deletion area until the scheduled task "Empty Questionnaire Recycle Bin" runs. Once the retention period expires, the cron job will permanently delete the question from the database.

Note: The permanent deletion depends on the system’s cron job running as scheduled. Users should pay attention to the "Time of permanent deletion" label if they want to recover a question before it is lost.

If you want us to explain more details note with some images/icons please let us know.

@mchurchward
Copy link
Copy Markdown
Contributor

Thanks for your workflow description. Does this change implement that entire workflow? Or is this intended to be one part of it?

@tailetan
Copy link
Copy Markdown
Contributor

tailetan commented Jun 12, 2025

@mchurchward yes this change implement that entire workflow.

@mchurchward
Copy link
Copy Markdown
Contributor

Okay, great. I will review this in its entirety.
For now, can you change the version update from 2025060600.00 to 2022121601.02 please. It is easier for me to manage the major version updates at release time.

@tailetan
Copy link
Copy Markdown
Contributor

@mchurchward I have just updated the version. Please review it. Thank you.

Copy link
Copy Markdown
Contributor

@mchurchward mchurchward left a comment

Choose a reason for hiding this comment

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

I have left some inline comments that need to get dealt with. I will continue the functional review as well.

When I upgrade from the previous version of questionnaire, and go to the "Question deletion area" of the edit questions function, the new icons are huge and not usable.

There is a failing Behat test.

@mchurchward
Copy link
Copy Markdown
Contributor

I have rebased it and merged it in with pull request 676.

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