Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Add respondent subject metadata to applet base info (M2-8164, M2-8026) #1646

Merged
merged 2 commits into from
Nov 5, 2024

Conversation

farmerpaul
Copy link
Contributor

@farmerpaul farmerpaul commented Nov 1, 2024

  • Tests for the changes have been added

📝 Description

🔗 Jira Ticket M2-8164
🔗 Jira Ticket M2-8026

This change adds respondentMeta to the response for GET /applets/{applet_id}/base-info to provide the Web App with the current respondent's subject ID, which is required to determine if a previous submission is a self-report in order to fix the bug reported by M2-8164.

To note: respondentMeta is already provided in two other existing endpoints, but not by ones consumed by the Web App. To ensure uniformity of this data structure across all three endpoints, created a function SubjectsService.to_respondent_meta and reused it in all 3 places.

Example response
{
    "result": {
        "displayName": "Applet 3",
        "version": "1.2.1",
        "description": "",
        "about": "",
        "image": "",
        "watermark": "",
        "id": "57c19b5c-bff9-4687-8961-6d8c66288a2c",
        "createdAt": "2024-10-23T17:50:18.212814",
        "updatedAt": "2024-10-31T21:10:41.214624",
        "activities": [
            {
                "id": "f53141c3-7a70-4c4f-b5f9-adbe17154959",
                "name": "Activity With Paragraph Phrase",
                "description": "",
                "image": "",
                "isHidden": false,
                "order": 1,
                "containsResponseTypes": [
                    "paragraphText",
                    "singleSelect",
                    "phrasalTemplate"
                ],
                "itemCount": 3,
                "autoAssign": true
            }
        ],
        "activityFlows": [],
        "respondentMeta": {
            "subjectId": "fc222d53-eaa0-4e5a-bf1b-8d3b1fb53e57",
            "nickname": "Paul HH",
            "tag": "Team"
        }
    }
}

🪤 Peer Testing

  1. Log into the Web App
  2. While having DevTools open to the Network tab, navigate to an applet
  3. Inspect the response of the /applets/{applet_id}/base_info request:
    Expected outcome: The response should include a respondentMeta object containing subjectId, nickname, and tag.

`respondent_meta` is already generated in two places, and now it's also
returned by the `/applets/{applet_id}/base_info` endpoint. So ensure
consistent structure, created a static method for generating it in
`SubjectsService`.
Copy link

github-actions bot commented Nov 1, 2024

➡️ Preview environment failed to be destroyed

Copy link

github-actions bot commented Nov 1, 2024

❌ E2E tests failed

@farmerpaul
Copy link
Contributor Author

@Phillipe-Bojorquez @egodoy-metalab I'm seeing failing E2E steps in my PR as well, but I don't understand why they're failing. I don't see actual failed tests, just odd errors like "Resource not accessible by personal access token" and "Resource not accessible by integration". Maybe a misconfiguration?

CleanShot 2024-11-01 at 14 53 25

@farmerpaul farmerpaul changed the title fix: Add respondent subject metadata to applet base info (M2-8164) fix: Add respondent subject metadata to applet base info (M2-8164, M2-8026) Nov 1, 2024
Copy link
Contributor

@rcmerlo rcmerlo left a comment

Choose a reason for hiding this comment

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

Great work!

@Phillipe-Bojorquez
Copy link
Contributor

@Phillipe-Bojorquez @egodoy-metalab I'm seeing failing E2E steps in my PR as well, but I don't understand why they're failing. I don't see actual failed tests, just odd errors like "Resource not accessible by personal access token" and "Resource not accessible by integration". Maybe a misconfiguration?

You can see the failure report more easily here
The link is available in the generate report URL section of the checks.

@farmerpaul
Copy link
Contributor Author

farmerpaul commented Nov 4, 2024

@Phillipe-Bojorquez thanks for the helpful pointer. It looks like some E2E tests are now failing because some tests against endpoints are using strict deep equality comparison checks, and my change in this PR adds new properties to each of these endpoint responses:

  • GET /applets/{applet_id}/base_info
  • GET /applets/{applet_id}
  • GET /activities/applet/{applet_id}

Separate to the above, it appears that that's another test that's failing that seems unlikely to be related to my work, "Add item to cart".

What do I need to do to make sure it's tracked that the tests need to get fixed? Just tagging you and @egodoy-metalab?

@farmerpaul farmerpaul merged commit cd06aa6 into develop Nov 5, 2024
11 of 17 checks passed
@farmerpaul farmerpaul deleted the fix/M2-8164-add-respondent-meta-to-base-info branch November 5, 2024 17:08
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.

3 participants