google / ground-android

Ground mobile data collection app for Android

Home Page:http://groundplatform.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Data collection] Done button not showing when conditional task is final task

gino-m opened this issue · comments

The button label should say "Done", instead it shows "Next".

Survey (with ACL removed)..

{
  "description": "",
  "jobs": {
    "wr7jv1ZXAAKJ50x2z21y": {
      "name": "Label a point",
      "id": "wr7jv1ZXAAKJ50x2z21y",
      "defaultStyle": {
        "color": "#F37C22"
      },
      "tasks": {
        "R3bgHzIrNZywrUrzkQJy": {
          "addLoiTask": false,
          "label": "Land cover",
          "options": {
            "iwR633IAkxzdILsByP3I": {
              "code": "",
              "label": "Forestland",
              "index": 0
            },
            "CWNRTdcdMJih8QxvjRSj": {
              "label": "Other",
              "code": "",
              "index": 5
            },
            "MSx7wqwadWxwUADyLyrm": {
              "code": "",
              "index": 3,
              "label": "Grassland"
            },
            "P1Q8Nk8mqpT0u3syCDGb": {
              "index": 4,
              "code": "",
              "label": "Wetland"
            },
            "jiEa0g8vziTuNy2BEy97": {
              "label": "Settlements",
              "code": "",
              "index": 2
            },
            "i71ttovXowWXwmyGxBCd": {
              "index": 1,
              "label": "Cropland",
              "code": ""
            }
          },
          "index": 1,
          "type": "multiple_choice",
          "cardinality": "select_one",
          "hasOtherOption": false,
          "required": false
        },
        "VVm0OjJKpNXwETo3rULk": {
          "required": true,
          "label": "Define plot boundaries",
          "type": "draw_area",
          "index": 0,
          "addLoiTask": true
        },
        "GAie6HrMvn3q2BTYu6uN": {
          "options": {
            "lvdc5KuRM2MnqgtnHoxC": {
              "index": 0,
              "label": "Palm",
              "code": ""
            },
            "wDmg0bu7aOWMtyUtrsse": {
              "index": 2,
              "code": "",
              "label": "Coffee"
            },
            "labNfMorqBAqtDSlirCS": {
              "code": "",
              "index": 1,
              "label": "Cocoa"
            },
            "1jICyjEFlLrGXBHtEemd": {
              "label": "Rubber",
              "code": "",
              "index": 5
            },
            "OZ7uGXZmi0kdPhBXX6GN": {
              "index": 4,
              "code": "",
              "label": "Beef"
            },
            "GRPbVwNbYoKAmgQzK6nI": {
              "label": "Soy",
              "code": "",
              "index": 3
            }
          },
"condition": {
    "matchType": "MATCH_ALL",
    "expressions": [
         {
            "expressionType": "ONE_OF_SELECTED",
            "taskId": "R3bgHzIrNZywrUrzkQJy",
            "optionIds": ["i71ttovXowWXwmyGxBCd"]
         }
      ]
    },
          "required": false,
          "label": "Subtypes cropland",
          "index": 2,
          "hasOtherOption": false,
          "addLoiTask": false,
          "cardinality": "select_one",
          "type": "multiple_choice"
        },
        "oHTFUT8m3Pa4wHJGb58t": {
          "label": "North facing",
          "type": "photo",
          "index": 3,
          "addLoiTask": false,
          "required": false
        }
      },
      "index": 1,
      "strategy": "MIXED"
    }
  },
  "title": "Land cover descriptors",
  "acl": {
   // ...
  }
}

@sufyanAbbasi FYI

Needed to modify your survey since a photo task was added at the end. To repro, the second to last task needs to be non-conditional, and the last task hidden due to unfulfilling the condition. In this situation, the Done button does not get rendered since it's not the actual last task in the list even though it's the last task in the sequence. I think the problem is that the "Done" button is triggered when the current view is the final view in the list of absolute views, but is not calculated dynamically.

It gets really weird when the task that triggers subsequent conditions is the last task in the sequence, then it has no way of knowing that it is or isn't the last task!

I didn't end up fixing this problem the first time since it was a bit out of my understanding, but I'm happy to tackle it after I get some P0s or P1s out of the way.

Conditional task is the final task:
Screenshot 2024-03-21 at 5 34 08 PM

Non-conditional task is the final task (the previous one is hidden):
Screenshot 2024-03-21 at 5 35 13 PM