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

Polls > "poll.add" event is never fired due to logic error

    Details

    • Type: Bug
    • Status: Verified
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 11.4, 12.4, 19.0
    • Fix Version/s: 12.5, 19.0
    • Component/s: Polls
    • Labels:
      None
    • 12 status:
      Resolved
    • Test Plan:
      Hide

      Please add a Test Plan here.

      Show
      Please add a Test Plan here.

      Description

      The event "poll.add" is never fired due to a logic error:

              if (t.getId() == null) {
                  newPoll = true;
                  t.setId(idManager.createUuid());
              }
      
      ...
      ...
      ...
      
              if (newPoll)
              	externalLogic.postEvent("poll.add", "poll/site/"
                          + t.getSiteId() + "/poll/" + t.getId(), true);
              else
              	externalLogic.postEvent("poll.update", "poll/site/"
                          + t.getSiteId() + " /poll/" + t.getId(), true);
      

      Where Poll.getID() is:

          public String getId() {
              if (entityID == null) {
                  entityID = id + "";
              }
              return entityID;
          }
      

      In this situation, t.getId() returns a string of "null", and thus never satisfies the condition to flip the newPoll boolean to true. The code should be checking for the absence/null value of the actual ID of the poll, not the entity ID:

      if (t.getPollId() == null)
      

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                bjones86 Brian Jones
                Reporter:
                bjones86 Brian Jones
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Git Source Code