dicarlolab / mturkutils

High-throughput web-based human psychophysics
0 stars 4 forks source link

Bug in ensure_index? #2

Closed hahong closed 11 years ago

hahong commented 11 years ago

The code says there's a bug in: col.ensure_index([('WorkerID', pymongo.ASCENDING), ('Timestamp', pymongo.ASCENDING)], unique=True)

Could anyone explain what it is? @esolomon @ardila

esolomon commented 11 years ago

If that throws an error, I assume it means it found an identical entry in the same collection, assuming entries are uniquely identified by a WorkerID and a timestamp (which they definitely should be -- a single Worker cannot submit two assignments simultaneously). Is that what you were asking?

-Ethan

On Tue, Sep 24, 2013 at 9:08 PM, Ha Hong notifications@github.com wrote:

The code says there's a bug in: col.ensure_index([('WorkerID', pymongo.ASCENDING), ('Timestamp', pymongo.ASCENDING)], unique=True)

Could anyone explain what it is? @esolomon https://github.com/esolomon @ardila https://github.com/ardila

— Reply to this email directly or view it on GitHubhttps://github.com/dicarlolab/mturkutils/issues/2 .

hahong commented 11 years ago

Well, maybe. Someone put a comment "bug" at the end of the line like:

col.ensure_index([('WorkerID', pymongo.ASCENDING), 
   ('Timestamp', pymongo.ASCENDING)], unique=True)   # bug

That comment only exists in updateDBwithHITslocal() not in updateDBwithHITs(), although the statement is exactly the same between the two methods.

I wasn't sure whether: (1) the statement itself needs to be fixed when used in updateDBwithHITslocal(), (2) the statement is somewhat incorrect in general (regardless of methods), or (3) the statement itself is okay but there are some other logical mistakes there.

hahong commented 11 years ago

Works okay as of now (commit 6d3257f17dcf2a411cf5ed6c450c1c611f035833)