zooniverse / Zooniverse

27 stars 13 forks source link

Convert Subjects into POJOs when making Recents #38

Closed edpaget closed 10 years ago

edpaget commented 10 years ago

Prevents duplicate subjects from being shown, by making sure destroyed subjects aren't readded to the subject queue when they're made into a recent

edpaget commented 10 years ago

So I added a console.trace; console.log(Subject.instances.map((s) -> s.zooniverse_id)) to the Subject constructor when I was testing. After each classification, the Subject constructor was being called, as expected, from its child class SubjectForRecent, but the subject it was being called was being added to back into the Subject.instances array.

Adding a console.log(@constructor) to the BaseModel constructor confirmed that, at least in Firefox, the Subject object that had been passed to SubjectFromRecent still had this.constructoras Subject. And my console.log(Subject.instances.map((s) -> s.zooniverse_id)) confirmed that it was being added back to the Subject.instances array.

brian-c commented 10 years ago

Bizarre. I can't duplicate that behavior here. Want to just point Asteroid Zoo at this commit until we can figure out why it's doing this?

I think hard coding the keys in a subject is going to break the new Planet Hunters, where subjects come back with non-standard keys.

Maybe pass in JSON.parse JSON.stringify subject?

Eh, I want to look at this more tomorrow.

edpaget commented 10 years ago

Yeah I was thinking of using json parsing as well.I'll switch to that then point Asteroid at it.

It could just be something weird happening in asteroid zoo. Although I was seeing complaints about duplicates on the Condor Watch talk, which I think also uses this version of the library. On Jun 25, 2014 8:28 AM, "Brian Carstensen" notifications@github.com wrote:

Bizarre. I can't duplicate that behavior here. Want to just point Asteroid Zoo at this commit until we can figure out why it's doing this?

I think hard coding the keys in a subject is going to break the new Planet Hunters, where subjects come back with non-standard keys.

Maybe pass in JSON.parse JSON.stringify subject?

Eh, I want to look at this more tomorrow.

— Reply to this email directly or view it on GitHub https://github.com/zooniverse/Zooniverse/pull/38#issuecomment-47100315.

edpaget commented 10 years ago

@aweiksnar and I confirmed that the same behaviour happens for him in Chrome on OS X as well.

edpaget commented 10 years ago

40 is waaaaaay beter