Пример #1
0
        public static Dictionary <string, List <SatyamTaskTableEntry> > OrganizeMTurkTasksByGUID()
        {
            SatyamTaskTableAccess taskDB = new SatyamTaskTableAccess();

            //get all the MTURK related entries in the task Table
            List <SatyamTaskTableEntry> mturkEntries = new List <SatyamTaskTableEntry>();

            foreach (string taskTemplate in TaskConstants.MTurkTaskTemplates)
            {
                List <SatyamTaskTableEntry> entries = taskDB.getAllEntriesByJobtemplateType(taskTemplate);
                mturkEntries.AddRange(entries);
            }
            taskDB.close();

            if (mturkEntries.Count == 0) //there is nothing to do!!
            {
                return(null);
            }

            //Group them by jobguids since each job can have many tasks
            Dictionary <string, List <SatyamTaskTableEntry> > TasksByGUID = new Dictionary <string, List <SatyamTaskTableEntry> >();

            foreach (SatyamTaskTableEntry entry in mturkEntries)
            {
                string guid = entry.JobGUID;
                if (!TasksByGUID.ContainsKey(entry.JobGUID))
                {
                    TasksByGUID.Add(entry.JobGUID, new List <SatyamTaskTableEntry>());
                }
                TasksByGUID[guid].Add(entry);
            }
            return(TasksByGUID);
        }