Skip to content

Commit 0d02974

Browse files
committed
Fix in cost edition
1 parent d3253f2 commit 0d02974

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

MLC/db/sqlite/sqlite_repository.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ def get_individual_with_min_cost(self):
212212
conn = self.__get_db_connection()
213213
cursor = conn.execute(stmt_get_individual_with_min_cost())
214214

215-
# We are expecting just one result
215+
# We are expecting just one resultte
216216
min_indiv_id = cursor.fetchone()[0]
217217
cursor.close()
218218
return min_indiv_id
@@ -230,7 +230,7 @@ def get_individual_data(self, individual_id):
230230
cursor = conn.execute(stmt_get_individual_data(individual_id))
231231

232232
for row in cursor:
233-
data._add_data(row[0], row[1], row[2])
233+
data._add_data(row[0] - self.__base_gen + 1, row[1], row[2])
234234

235235
cursor.close()
236236
conn.commit()
@@ -267,7 +267,9 @@ def update_individual_cost(self, individual_id, cost, evaluation_time, generatio
267267
if generation == -1:
268268
stmt_to_update_cost = stmt_update_all_costs(individual_id, cost, evaluation_time)
269269
else:
270-
stmt_to_update_cost = stmt_update_cost(individual_id, cost, evaluation_time, generation)
270+
stmt_to_update_cost = stmt_update_cost(individual_id, cost,
271+
evaluation_time,
272+
generation + self.__base_gen - 1)
271273

272274
logger.debug("[SQLITE_REPO] [UPDATE_INDIV_COST] - Query executed: {0}"
273275
.format(stmt_to_update_cost))

0 commit comments

Comments
 (0)