Uploaded image for project: 'Sakai'
  1. Sakai
  2. SAK-26495

Options and votes should also be deleted when delete a poll.

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: CLOSED
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.7.1
    • Fix Version/s: 2.9.0
    • Component/s: Polls
    • Labels:
    • Previous Issue Keys:
      POLL-135

      Description

      When a poll deletion action is performed now, it only delete a poll and leave the options and votes related to it.
      Consider this situation:

      Database:MySQL, and the primary key of POLL_POLL, POLL_OPTION and POLL_VOTE is auto_inc.
      1. An instructor(say Alice) created a poll(id=1) with some options(id=1,2,3,4), and some students voted it(id=1,2,3)
      2. The instructor delete the vote. This action only delete the poll(id=1) and leave the options and votes like orphans.
      3. For some reason, an DB backup/restore action is executed.
      4. Another instructor(say Bob) create a poll. This poll will assigned by the same ID(id=1). He will see the options(id=1,2,3,4) appear in his new poll without any more actions. Also, if the poll is created by Alice in the same course site, the poll vote will be assigned to some students even they haven't seen the poll.

      Here is my solution:
      1. Delete the relevant options and votes when delete a poll.
      2. Delete the relevant votes when (hard) delete an option.

      About the Attachment
      1. Modify /polls/impl/src/java/org/sakaiproject/poll/service/impl/PollListManagerImpl.java to perform these actions. And inject a PollVoteManager to delete votes of a poll/option.
      2. Modify /polls/pack/src/webapp/WEB-INF/components.xml to inject PollVoteManager.
      3. Delete the mothod testDeletePoll of /polls/impl/src/test/org/sakaiproject/poll/logic/test/PollListManagerTest.java. Since this test method will generate an error.
      4. SQL statments to delete the exist orphan optoins and votes.

        Gliffy Diagrams

          Zeplin

            Attachments

            1. mysql.sql
              0.2 kB
            2. src.diff
              5 kB
            3. src.zip
              8 kB

              Activity

                People

                Assignee:
                dhorwitz David Horwitz
                Reporter:
                gaojun Gao Jun
                Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved:

                    Git Integration