|
@@ -298,11 +298,16 @@ class WordDatabase(DataBase):
|
|
# box 的概率比分别为:5:4:3:2:1
|
|
# box 的概率比分别为:5:4:3:2:1
|
|
|
|
|
|
count = 0
|
|
count = 0
|
|
|
|
+ double_check = (box == 6) # 如果 box 已经是 6 了, 就不需要二次检查了
|
|
while count == 0:
|
|
while count == 0:
|
|
if box == 1:
|
|
if box == 1:
|
|
- return None
|
|
|
|
|
|
+ if double_check:
|
|
|
|
+ return None
|
|
|
|
+ else:
|
|
|
|
+ double_check = True
|
|
|
|
+ box = 6
|
|
box -= 1
|
|
box -= 1
|
|
count = self.search(columns=["COUNT(ID)"], table="Word", where=f"box={box}")[0][0]
|
|
count = self.search(columns=["COUNT(ID)"], table="Word", where=f"box={box}")[0][0]
|
|
- get = self.search(columns=["word"], table="Word", limit=1, offset=random.randint(0, count))[0][0]
|
|
|
|
|
|
+ get = self.search(columns=["word"], table="Word", where=f"box={box}", limit=1, offset=random.randint(0, count))[0][0]
|
|
self.__logger.debug(f"Rand word {self.dict_name} from box: {box} count: {count} get: {get}")
|
|
self.__logger.debug(f"Rand word {self.dict_name} from box: {box} count: {count} get: {get}")
|
|
return self.find_word(get)
|
|
return self.find_word(get)
|