Uploaded image for project: 'OpenMRS Core'
  1. OpenMRS Core
  2. TRUNK-2521

Multiple Program Workflow States with same start date

    Details

    • Complexity:
      Low

      Description

      Support for multiple program workflow state with the same start date?

      OpenMRS allows to have same day state transitions (e.g. initially enrolled and referred to another facility at the same day) and properly sets the end date for the first state to the same day in the DB and leaves the second state open without an end date.

      However the order of the states displayed in the UI and for voiding the last one isn't consistent. Sometimes the history of the states is ok; sometimes the already closed state is shown last. And it's not only a display problem as voiding the last state (aka the active one) sometimes voids the first already closed state, and sometimes the one which is still open. The two screenshots for the same patient should make it clear.

      The following patch applied to PatientProgram.java makes at least sure that always the last (open) state is displayed last. And this makes sure that voiding the last state always works correctly (until TRUNK-43 is addressed).

      Index: PatientProgram.java
      ===================================================================
      — PatientProgram.java (revision 22306)
      +++ PatientProgram.java (working copy)
      @@ -288,6 +288,13 @@
      Collections.sort(ret, new Comparator<PatientState>() {

      public int compare(PatientState left, PatientState right) {
      + // check if one of the states is active
      + if (left.getActive())

      { + return 1; + }

      + if (right.getActive())

      { + return -1; + }

      return OpenmrsUtil.compareWithNullAsEarliest(left.getStartDate(), right.getStartDate());
      }
      });

        Attachments

          Activity

            People

            • Assignee:
              raff Rafal Korytkowski
              Reporter:
              cneumann Christian Neumann
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: