fix(typing): solucionar loader NoneType y carga modular dinamica en moodle_replicator

This commit is contained in:
2026-10-16 16:10:37 -03:00
parent cf368036a6
commit 1e6faa1301
2 changed files with 8 additions and 5 deletions
+1
View File
@@ -5,6 +5,7 @@
], ],
"extraPaths": [ "extraPaths": [
"backend", "backend",
"scripts",
"backend/venv/Lib/site-packages" "backend/venv/Lib/site-packages"
], ],
"venvPath": "backend", "venvPath": "backend",
+7 -5
View File
@@ -594,7 +594,7 @@ def run_replication(
transformed_users = [MoodleUserTransformer.transform_user(u) for u in raw_participants] transformed_users = [MoodleUserTransformer.transform_user(u) for u in raw_participants]
all_exported_data[cid] = transformed_users all_exported_data[cid] = transformed_users
if dry_run: if dry_run or not loader:
print(f"[DRY-RUN] Se habrían procesado {len(transformed_users)} usuarios para curso local {local_course_id}.") print(f"[DRY-RUN] Se habrían procesado {len(transformed_users)} usuarios para curso local {local_course_id}.")
continue continue
@@ -656,10 +656,12 @@ def main():
if args.sync_app and export_path: if args.sync_app and export_path:
try: try:
try: import importlib
from scripts.import_moodle_to_app import import_moodle_users scripts_dir = os.path.dirname(os.path.abspath(__file__))
except ImportError: if scripts_dir not in sys.path:
from import_moodle_to_app import import_moodle_users sys.path.insert(0, scripts_dir)
_imp_mod = importlib.import_module("import_moodle_to_app")
import_moodle_users = getattr(_imp_mod, "import_moodle_users")
import_moodle_users(export_path) import_moodle_users(export_path)
except Exception as e: except Exception as e:
print(f"[!] Error al sincronizar con la base de datos de la App: {e}") print(f"[!] Error al sincronizar con la base de datos de la App: {e}")