diff --git a/.idea/.gitignore b/.idea/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..26d33521af10bcc7fd8cea344038eaaeb78d0ef5
--- /dev/null
+++ b/.idea/.gitignore
@@ -0,0 +1,3 @@
+# Default ignored files
+/shelf/
+/workspace.xml
diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml
new file mode 100644
index 0000000000000000000000000000000000000000..105ce2da2d6447d11dfe32bfb846c3d5b199fc99
--- /dev/null
+++ b/.idea/inspectionProfiles/profiles_settings.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/labsol-academy.iml b/.idea/labsol-academy.iml
new file mode 100644
index 0000000000000000000000000000000000000000..8e5446ac9594d6e198c2a2923123566d13b94bf9
--- /dev/null
+++ b/.idea/labsol-academy.iml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000000000000000000000000000000000000..a102f0cef3ebd8a6dc2cdcf8ac6c9370e3b44484
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000000000000000000000000000000000000..adb63fc2a4bf08b2728bae77b3b0a09c45580504
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000000000000000000000000000000000000..35eb1ddfbbc029bcab630581847471d7f238ec53
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/clase/models.py b/clase/models.py
index 2fdcb41bec6c8219d5956ca554caad2db886418d..308f9c1b08d3a4e0b399afac938c2db3aa884b21 100644
--- a/clase/models.py
+++ b/clase/models.py
@@ -27,3 +27,4 @@ class VistaClase(models.Model):
clase = models.ForeignKey(Clase, on_delete=models.CASCADE)
curso = models.ForeignKey(Curso, on_delete=models.CASCADE)
fecha_ultima_visualizacion = models.DateTimeField(auto_now=True)
+
\ No newline at end of file
diff --git a/curso/views.py b/curso/views.py
index 3a255152b467316add66640d70199b214fb30e41..75e2400bd5ff86b9f0e4e0fa717bd72eea115346 100644
--- a/curso/views.py
+++ b/curso/views.py
@@ -75,6 +75,7 @@ def get_solicitud_curso(request):
paginator = Paginator(solicitud, 6)
page_number = request.GET.get("page")
page_obj = paginator.get_page(page_number)
+ usuario=UsuarioPersonalizado.get_or_c
return render(request, 'curso/solicitud/solicitud_lista.html', {"pagination": page_obj})
diff --git a/mydatabase b/mydatabase
index 1ecf69ab9d67da5c2d907747a445de99e4eab852..f1d766a4e22c4ef88048d8fff51daf50734051b0 100644
Binary files a/mydatabase and b/mydatabase differ
diff --git a/static/js/eliminar_inscritos_admin.js b/static/js/eliminar_inscritos_admin.js
index 19e555d5972aee62be7b51d7282277ac47a195aa..ae780c8812f77525122adfa3df47ee64eb3e3701 100644
--- a/static/js/eliminar_inscritos_admin.js
+++ b/static/js/eliminar_inscritos_admin.js
@@ -1,13 +1,16 @@
+
async function eliminarSuscripcion(estudianteId, cursoId) {
try {
const csrfToken = document.querySelector('#csrf-form [name=csrfmiddlewaretoken]').value;
const data = await obtenerInscripciones();
-
- const elementoEliminar = data.find(item => (item.curso === cursoId && item.estudiante === estudianteId));
+ const curso = await obtenerCursosVistos();
- if (elementoEliminar) {
+ const elementoEliminar = data.find(item => (item.curso === cursoId && item.estudiante === estudianteId));
+ const cursosVisto=curso.find(item=>(item.curso===cursoId && item.estudiante === estudianteId))
+ if (elementoEliminar && cursosVisto ) {
await eliminarInscripcion(elementoEliminar.id, csrfToken);
+ await cursoVistoEliminar(cursosVisto.id,csrfToken)
window.location.reload();
} else {
console.error('No se encontró la suscripción para eliminar');
@@ -26,7 +29,15 @@ async function obtenerInscripciones() {
throw new Error('Error al obtener los datos');
}
}
-
+async function obtenerCursosVistos(){
+ try {
+ const response = await fetch('/api/clases_vistas/');
+ const data = await response.json();
+ return data;
+ } catch (error) {
+ throw new Error('Error al obtener los datos');
+ }
+}
async function eliminarInscripcion(idEliminar, csrfToken) {
try {
const response = await fetch(`/api/inscripcion/${idEliminar}`, {
@@ -43,3 +54,19 @@ async function eliminarInscripcion(idEliminar, csrfToken) {
throw new Error('Error al realizar la solicitud DELETE');
}
}
+async function cursoVistoEliminar(idEliminar,csrfToken){
+ try {
+ const response = await fetch(`/api/clase_vista/${idEliminar}`, {
+ method: 'DELETE',
+ headers: {
+ 'Content-Type': 'application/json',
+ 'X-CSRFToken': csrfToken,
+ },
+ });
+ if (!response.ok) {
+ throw new Error('Error al eliminar la suscripción');
+ }
+ } catch (error) {
+ throw new Error('Error al realizar la solicitud DELETE');
+ }
+}
\ No newline at end of file