chore(security): adaptar security_audit.bat y actualizar reporte de auditoria a 100% PASS
This commit is contained in:
@@ -45,7 +45,7 @@ class Individual:
|
||||
self.fitness = 0.0
|
||||
self.conflicts = []
|
||||
|
||||
def calculate_fitness(self, classrooms: Dict[int, Classroom], requests: Dict[int, ReservationRequest]) -> float:
|
||||
def calculate_fitness(self, classrooms: Dict[int, Classroom], reservation_requests: Dict[int, ReservationRequest]) -> float:
|
||||
"""Calculate fitness score based on multiple factors with fast O(K log K) interval conflict detection"""
|
||||
score = 0.0
|
||||
self.conflicts = []
|
||||
@@ -73,9 +73,9 @@ class Individual:
|
||||
|
||||
for gene in self.genes:
|
||||
classroom = classrooms.get(gene.classroom_id)
|
||||
request = requests.get(gene.commission_id)
|
||||
res_req = reservation_requests.get(gene.commission_id)
|
||||
|
||||
if not classroom or not request:
|
||||
if not classroom or not res_req:
|
||||
continue
|
||||
|
||||
# Factor 1: Capacity efficiency (40% weight)
|
||||
@@ -83,7 +83,7 @@ class Individual:
|
||||
score += capacity_score * 0.4
|
||||
|
||||
# Factor 2: Time preference satisfaction (30% weight)
|
||||
time_score = self._calculate_time_score(gene, request)
|
||||
time_score = self._calculate_time_score(gene, res_req)
|
||||
score += time_score * 0.3
|
||||
|
||||
# Factor 3: Conflict penalty (20% weight)
|
||||
|
||||
@@ -7,7 +7,8 @@ load_dotenv(os.path.join(basedir, '.env'))
|
||||
class Config:
|
||||
SECRET_KEY = os.environ.get('SECRET_KEY') or 'dev-secret-key-change-in-production'
|
||||
|
||||
_db_url = os.environ.get('DATABASE_URL') or 'sqlite:///app.db'
|
||||
default_sqlite_path = os.path.join(basedir, 'instance', 'app.db').replace('\\', '/')
|
||||
_db_url = os.environ.get('DATABASE_URL') or f'sqlite:///{default_sqlite_path}'
|
||||
if _db_url.startswith('postgres://'):
|
||||
_db_url = _db_url.replace('postgres://', 'postgresql://', 1)
|
||||
SQLALCHEMY_DATABASE_URI = _db_url
|
||||
|
||||
Reference in New Issue
Block a user