Incorrect unlocked numbers

Bug #982797 reported by Jono Bacon
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Ubuntu Accomplishments Daemon
Fix Released
Medium
Jono Bacon

Bug Description

In current trunk I have noticed that we are no longer displaying when a single accomplishment is unlocked (we are displaying the multiple accomplishment bubbles fine).

Revision history for this message
Rafał Cieślak (rafalcieslak256) wrote :

Jono, I am afraid I cannot reproduce this bug. On my system the daemon from trunk displays all bubbles, including the 'unlocked one accomplishment'. Are you sure this bug was not related to some branch?

Revision history for this message
Jono Bacon (jonobacon) wrote :

This is strange, I just tried it again and I have the same issue.

This is what I do:

 * Remove all my trophies and start the daemon - after Registered On Launchpad is achieved a number of others are unlocked. The correct number of unlocked trophies is shown.
 * A little later Reported First Bug should then unlock one trophy (First bug confirmed), but there is no bubble to say "You have unlocked one accomplishment".

Can you test again with current trunk in the daemon and viewer and see if you have this happen?

Changed in ubuntu-accomplishments-daemon:
status: New → Incomplete
Revision history for this message
Rafał Cieślak (rafalcieslak256) wrote :

Okay, seems I got this. This is my notifications log:

Firstly, I start the daemon.
--- longer break ---
You have accomplished something: Registered on Launchpad.
Unlocked 7 new accomplishments.
--- longer break ---
You have accomplished something: Signed Ubuntu Code of Conduct.
Unlocked 1 new accomplishment.
You have accomplished something: LoCo Team Member.
You have accomplished something: Report First Bug.
---longer break ---
You have accomplished something: Report First Bug that was Confirmed.
--- nothing else happens---

I do indeed get a "1 accomplishment unlocked" message, but you are right that there should be one which I don't get, just after "You have accomplished something: Report First Bug".

Revision history for this message
Jono Bacon (jonobacon) wrote :

I managed to dig into this some more this evening and I think I discovered the source of the problem.

The problem is that the current way in which we are checking for unlocked accomplishments is when the total number of scripts to run == the total number of results that have come in. This way we can determine when the scripts have completed a run.

The problem I think was introduced when we added the ability to trigger a script re-run - this means that by the time a trophy comes in we may well be part way though another script run, and thus sometimes we don't trigger the check for unlocked items.

The problem here seems to me that we are not effectively tracking state - we are comparing variables that are represent the current state of a script run, and as such we are getting race conditions.

To fix this bug I think we need to better track state. There are a few options here:

 * You added the ability to check the state of whether scripts are either RUNNING or NOT_RUNNING - we could possibly check to see if we are NOT_RUNNING and then check for unlocked items.
 * We could check when every trophy file comes in to see if there are unlocked items - the challenge here is that we are currently checking if there are unlocked items by running listAllAccomplishmentsAndStatus() to fill self.depends and this could also face state issues if the script runner is running.

It seems to me that what we might need to do is to perform a check at the end of a script run before the next script run is triggered. Any thoughts?

Revision history for this message
Jono Bacon (jonobacon) wrote :

Oh, and the other problem if we add the check for unlocked trophies at the end of run_scripts_for_user, this is before the accomplished trophies have been validated, so we would need validate them first.

Revision history for this message
Jono Bacon (jonobacon) wrote :

We decided to solve this by not tracking state for a group of accomplishments and checking for unlocked accomplishments as each trophy arrives. See https://lists.launchpad.net/ubuntu-accomplishments-contributors/msg00150.html for the discussion.

Changed in ubuntu-accomplishments-daemon:
assignee: nobody → Jono Bacon (jonobacon)
status: Incomplete → Fix Committed
Jono Bacon (jonobacon)
Changed in ubuntu-accomplishments-daemon:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.