tannerjc
(James Tanner)
November 29, 2023, 5:23pm
1
Hi folks,
As part of the ongoing enhancements and establishing feature parity with old-galaxy, I’ve opened a new PR for galaxy_ng to re-implement community surveys and scoring.
ansible:master
← jctanner:COMMUNITY_RATINGS_V2
opened 01:18AM - 21 Nov 23 UTC
Community scoring in old galaxy was based on a computed average of survey respon… ses from the UX users. On each role or collection, they could rate aspects of the content on a 1-5 scale or a yes/no (which translated to 1 or 5). A user could change their answers at will, but could not delete them. After the POST call to provide their responses, a new score for the content would be computed and displayed in the UX.
There was also a scoring component that derived from ansible-lint outputs, which was called "quality score". This PR does not attempt to re-implement that function.
The new endpoints are in api/v1 for multiple reasons:
- _ui/v1 is unsupported / unstable and flagged for migration to api/v3
- api/v3 is no longer truly a galaxy_ng controlled api but is instead a redirect to pulp.
- this feature is not yet ready for being a full on generic thing that is useful to satellite or other pulp stakeholders
- we need to iterate quickly on it for the community site
Example survey payload ...
```
{'docs': 3,
'does_what_it_says': 4,
'ease_of_use': 3,
'used_in_production': 1,
'works_as_is': 0}
```
For a role, the payload should be POST'ed to /api/v1/surveys/roles/`<roleid>`/
For a collection, the payload should be POST'ed to /api/v1/surveys/collections/`<namespace>`/`<name>`/ ... because we have no way of getting the pulp_id for a collection from the API right now.
Computed scores come from these endpoints ...
```
(venv) [jtanner@p1 galaxy_ng]$ curl -s http://localhost:5001/api/v1/scores/roles/ | jq .
{
"count": 1,
"next": null,
"previous": null,
"results": [
{
"id": 7,
"created": "2023-11-29T03:29:06.708629Z",
"modified": "2023-11-29T03:29:10.572142Z",
"role": 7,
"namespace": "jctannerTEST",
"name": "role1",
"score": "1.98"
}
]
}
```
```
(venv) [jtanner@p1 galaxy_ng]$ curl -s http://localhost:5001/api/v1/scores/collections/ | jq .
{
"count": 2,
"next": null,
"previous": null,
"results": [
{
"id": 1,
"created": "2023-11-29T02:53:09.562222Z",
"modified": "2023-11-29T02:53:13.397804Z",
"collection": "018c18fe-59a2-7cd1-8574-ea51f2105133",
"namespace": "autohubtest2",
"name": "krdqdlyw",
"score": "2.40"
},
{
"id": 2,
"created": "2023-11-29T03:29:31.486404Z",
"modified": "2023-11-29T03:29:35.316854Z",
"collection": "018c191f-a4b8-74cd-9389-a597da785d66",
"namespace": "autohubtest2",
"name": "adozvbxh",
"score": "1.63"
}
]
}
```
Scores have namespace and name filtering ...
```
(venv) [jtanner@p1 galaxy_ng]$ curl -s 'http://localhost:5001/api/v1/scores/collections/?namespace=autohubtest2&name=adozvbxh' | jq .
{
"count": 1,
"next": null,
"previous": null,
"results": [
{
"id": 2,
"created": "2023-11-29T03:29:31.486404Z",
"modified": "2023-11-29T03:29:35.316854Z",
"collection": "018c191f-a4b8-74cd-9389-a597da785d66",
"namespace": "autohubtest2",
"name": "adozvbxh",
"score": "1.63"
}
]
}
```
Both the role and the collection scores can be filtered by their roleid or collectionid, if known.
The new code attempts to mimic the old feature as closely as is possible. The old survey responses will be migrated into the new system once the patch lands, and the scores will be recomputed.
We still have to do a lot of UX work to make use of the new APIs, but that was held up by getting this PR done first.
If you have any thoughts or suggestions about the new PR, please feel free to drop a review comment. If you have thoughts or suggestions about future changes or enhances to the surveys and scores in general, feel free to add a comment in this thread.
Thanks,
JT
3 Likes