示例#1
0
文件: HumanEval.cs 项目: PavelPZ/REW
 public static IEnumerable<HumanEval> readAllForLines(azure.driverLow db, string compId) {
   return db.executeQuery(db.keyRangeQuery<HumanEval>(partitionKey(compId), azure.keyLib.createKeyLow(keys(LineIds.no, null).Take(1))));
 }
示例#2
0
文件: HumanEval.cs 项目: PavelPZ/REW
 public static void refreshEvals(azure.driverLow db, string compId, LineIds line, string email, string productId, int testKeyId, AzureData.saveKeyDataObj[] pcEvals) {
   var res = readOrCreate(db, compId, line, email);
   //adjust test
   if (res.dataObj == null) res.dataObj = new List<azure.hmanEvalController.testItem>();
   var test = res.dataObj.FirstOrDefault(t => t.productId == productId && t.testKeyId == testKeyId);
   if (test == null) res.dataObj.Add(test = new azure.hmanEvalController.testItem { productId = productId, testKeyId = testKeyId });
   if (test.items == null) test.items = new List<azure.hmanEvalController.exItem>();
   //zatrid pcEvals
   foreach (var eval in pcEvals) {
     if ((eval.flag & CourseDataFlag.testImpl_result) == CourseDataFlag.testImpl_result)
       test.flag = eval.flag;
     else {
       var item = test.items.FirstOrDefault(it => it.key == eval.key);
       if (item == null) test.items.Add(item = new azure.hmanEvalController.exItem { key = eval.key, flag = eval.flag });
       item.flag = eval.flag;
       if ((item.flag & CourseDataFlag.needsEval) == 0) test.items.Remove(item);
     }
   }
   if ((test.flag & CourseDataFlag.needsEval) == 0) {
     if (test.items.Count > 0) throw new Exception("test.items.Count > 0");
     res.dataObj.Remove(test);
   }
   //empty and attach
   if (res.isNew()) //new
     if (res.dataObj.Count == 0) { } else db.attach(res, TableOperationType.Insert);
   else //old
     db.attach(res, res.dataObj.Count == 0 ? TableOperationType.Delete : TableOperationType.Replace);
 }
示例#3
0
文件: HumanEval.cs 项目: PavelPZ/REW
 public static HumanEval[] readAllForLine(azure.driverLow db, string compId, LineIds line) {
   return db.executeQuery(db.keyRangeQuery<HumanEval>(partitionKey(compId), azure.keyLib.createKeyLow(keys(line, null).Take(2)))).ToArray();
 }
示例#4
0
文件: HumanEval.cs 项目: PavelPZ/REW
 public static HumanEval readOrCreate(azure.driverLow db, string compId, LineIds line, string email) {
   var example = new HumanEval(compId, line, email);
   return db.read(example) ?? example;
 }