astrodatagui: StarsDB: getAllStars: return dictionary instead of ambigous array

This commit is contained in:
2024-05-13 15:58:30 +02:00
parent 39da56ab6c
commit 92120af68f
2 changed files with 6 additions and 4 deletions
+2 -3
View File
@@ -149,7 +149,7 @@ class AstrodataGUI(QtWidgets.QMainWindow):
self.listDownloaded.clear() self.listDownloaded.clear()
for star in self.starDB.getAllStars(): for star in self.starDB.getAllStars():
self.listDownloaded.addItem(star[0]) self.listDownloaded.addItem(star)
def updateSequenceList(self, sourceSeqTouple): def updateSequenceList(self, sourceSeqTouple):
self.listSequences.clear() self.listSequences.clear()
@@ -347,8 +347,7 @@ class AstrodataGUI(QtWidgets.QMainWindow):
def btCountAllFlaresClicked(self): def btCountAllFlaresClicked(self):
allStarsDictList = [] allStarsDictList = []
for star in self.starDB.getAllStars(): for starName in self.starDB.getAllStars():
starName = star[0]
sequences = self.starDB.getStarSequences(starName) sequences = self.starDB.getStarSequences(starName)
infos = self.starDB.getStarInfos(starName) infos = self.starDB.getStarInfos(starName)
for sourceSeq in sequences: for sourceSeq in sequences:
+4 -1
View File
@@ -132,7 +132,10 @@ class StarDB():
def getAllStars(self): def getAllStars(self):
res = self.dbCursor.execute("""SELECT DISTINCT mainName FROM stars res = self.dbCursor.execute("""SELECT DISTINCT mainName FROM stars
ORDER BY mainName""") ORDER BY mainName""")
return res.fetchall() resList = []
for s in res.fetchall():
resList.append(s[0])
return resList
def getStarSequences(self, mainName): def getStarSequences(self, mainName):
res = self.dbCursor.execute(f"""SELECT sourceName, sequence FROM stars res = self.dbCursor.execute(f"""SELECT sourceName, sequence FROM stars