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

feat: Add the name of the image contributor #953

Merged
merged 1 commit into from
Aug 12, 2024

Conversation

g123k
Copy link
Contributor

@g123k g123k commented Jul 19, 2024

Hi everyone,

On the images field, the API returns the contributor's name.
Eg:

        "images": {
            "1": {
                "sizes": {
                    "100": {
                        "h": 71,
                        "w": 100
                    },
                    "400": {
                        "h": 284,
                        "w": 400
                    },
                    "full": {
                        "h": 1089,
                        "w": 1536
                    }
                },
                "uploaded_t": 1345799270,
                "uploader": "openfoodfacts-contributors"

@g123k g123k requested a review from a team as a code owner July 19, 2024 09:50
@@ -169,6 +170,7 @@ class JsonHelper {
height: JsonObject.parseInt(numberObject[_ALL_IMAGES_TAG_HEIGHT]),
url: numberObject[_ALL_IMAGES_TAG_URL],
uploaded: uploaded,
contributor: fieldObject[_ALL_IMAGES_TAG_UPLOADER],
Copy link
Contributor

Choose a reason for hiding this comment

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

_ALL_IMAGES_TAG_UPLOADED appears in both allImagesToJson and allImagesFromJson.
In your code _ALL_IMAGES_TAG_UPLOADER appears only once. Probably something needs to be fixed.
Additional unit tests would help, too.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I didn't include the 'to' method on purpose, because today, images are well assigned to the contributor.
But I can add do, no pb.

In terms of tests, despite checking the result of the server, I don't really see any benefits here.

@teolemon
Copy link
Member

Thanks @g123k @M123-dev
Just to be sure, are we getting it as part of the standard payload ? Are there some cases where it might not be desirable (eg coke with loads of images ?)

@teolemon teolemon merged commit 9296ce6 into openfoodfacts:master Aug 12, 2024
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

4 participants