Skip to content

Results are not idem-potents #20

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

Closed
pcorbel opened this issue Feb 11, 2020 · 1 comment · Fixed by #23
Closed

Results are not idem-potents #20

pcorbel opened this issue Feb 11, 2020 · 1 comment · Fixed by #23

Comments

@pcorbel
Copy link

pcorbel commented Feb 11, 2020

Expected Behavior

When using the client, I should be able to have idem-potent results when iterating over campaign_results by campaign_id

Current Behavior

Results are different if I fetch campaign_results from campaign 123, then 456, then 789 from when I fetch campaign_results from 789, then 456, then 123.

Possible Solution

I have to "refresh" my client by calling api = ub.APIClient("xxx", "xxx") at each run

Steps to Reproduce

import usabilla as ub

api = ub.APIClient("xxx", "xxx")

# This order won't give the same results as 
# for campaign in ["123", "456", "789", "foo"]:
# This order
for campaign in ["foo", "123", "456", "789"]:
	# If I refresh the client here, it works 
    # api = ub.APIClient("xxx", "xxx")
    responses = api.get_resource(
        api.SCOPE_LIVE,
        api.PRODUCT_WEBSITES,
        api.RESOURCE_CAMPAIGN_RESULT,
        campaign,
        iterate=True,
    )
    count = 0
    for response in responses:
        count = count + 1

    print(f"{campaign} {count}")

Results for first order:

campaign_id count
123 1593
456 0
789 77
foo 0

Results for another order:

campaign_id count
foo 23
123 14
456 0
789 77

Results when I refresh the client (good results):

campaign_id count
foo 23
123 1593
456 130
789 77

Context (Environment)

Docker image: python:3.7.4
Python lib: usabilla-api==2.0.1

@EdwinTh
Copy link

EdwinTh commented Jun 17, 2021

We have experienced similar problems. Are there plans to look into this?

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 a pull request may close this issue.

2 participants