diff --git a/clase/templates/clase/clases_estudiante.html b/clase/templates/clase/clases_estudiante.html
index 1b7234cff538a65389490b396afcaa5752bc0bcc..ef7388561b6465119622dcf45662b12ce0b50bd7 100644
--- a/clase/templates/clase/clases_estudiante.html
+++ b/clase/templates/clase/clases_estudiante.html
@@ -241,5 +241,137 @@
{% block js_externo %}
-
+
{% endblock js_externo %}
diff --git a/mydatabase b/mydatabase
index 97fd53d8f87894bc391a238a1fb07eb3febbf176..bf744a86a17dc3e855a56cb4489f125d19c16b51 100644
Binary files a/mydatabase and b/mydatabase differ
diff --git a/static/js/comentarios.js b/static/js/comentarios.js
deleted file mode 100644
index a7790af4618a278cce3bdf7fbbfbc6938ed4de24..0000000000000000000000000000000000000000
--- a/static/js/comentarios.js
+++ /dev/null
@@ -1,142 +0,0 @@
-
-
-
-
- async function fetchData(url, csrfToken) {
- try {
- const response = await axios.get(url, {
- headers: {
- 'X-CSRFToken': csrfToken,
- 'Content-type': 'application/json',
- },
- });
- return response.data;
- } catch (error) {
- console.error("Error fetching data:", error);
- throw error;
- }
- }
- async function postData(url, data, csrfToken) {
- try {
- const response = await axios.post(url, data, {
- headers: {
- 'X-CSRFToken': csrfToken,
- 'Content-type': 'application/json',
- },
- });
- return response.data;
- } catch (error) {
- console.error("Error:", error.response);
- throw error;
- }
- }
-
- async function sendViewedClassData(data, csrfToken) {
- try {
- const response = await postData("/api/clases_vistas/", data, csrfToken);
- } catch (error) {
- console.error("Error sending viewed class data:", error);
- }
- }
-
- async function DataApi() {
-
- const csrfToken = document.querySelector('#csrf-form [name=csrfmiddlewaretoken]').value;
- const video = document.getElementById("myVideo");
- const id_user = {{request.user.id}};
- const id_video = parseInt(video.dataset.id);
- const id_curso = parseInt(video.dataset.curso);
-
- try {
- video.addEventListener("ended", async () => {
- try {
-
- const class_view = await fetchData('/api/clases_vistas/', csrfToken);
- const view_exists = class_view.find(item => item.estudiante == id_user && item.clase == id_video);
-
- if (view_exists === undefined) {
- const fechaActual = new Date();
- const data = {
- estudiante: id_user,
- clase: id_video,
- curso: id_curso,
- fecha_ultima_visualizacion: fechaActual.toISOString()
- };
- await sendViewedClassData(data, csrfToken);
- }
- } catch (error) {
- console.error("Error fetching data:", error);
- }
- });
- } catch (error) {
- console.error("Error:", error);
- }
- }
-
- function borrarComentario(id) {
- form = document.getElementById(id);
- form.elements["contenido"].value = "";
- }
-
- function enviarComentario(url, id) {
- var formData = new FormData(document.getElementById(id));
- console.log(formData);
-
- fetch(url, {
- method: "POST",
- body: formData,
- })
- .then(function (response) {
- return response.json();
- })
- .then(function (data) {
- if (data.success) {
- borrarComentario(id);
- location.reload();
- } else {
- for (var field in data.errors) {
- var error = data.errors[field];
- var input = document.getElementById("id_" + field);
- input.classList.add("error");
- input.nextSibling.textContent = error;
- }
- }
- });
- }
- function displayContainer(id) {
- let container = document.getElementById(id);
- if (container.style.display === "none") {
- container.style.display = "block";
- } else {
- container.style.display = "none";
- }
- }
-
- const clase = document.getElementById("class-message");
-
- if( parseInt(clase.dataset.class) === 1 ){
- DataApi()
-
- let comentario = document.getElementById("contenedor-comentarios");
-
- comentario.addEventListener("click", function (event) {
- event.preventDefault();
- let id = event.target.dataset.id;
- let type = event.target.dataset.type;
- if (type == "send") {
- enviarComentario("{% url 'clase:agregar_comentario' %}", id);
- } else if (type == "cancel") {
- borrarComentario(id);
- } else if (type == "display-block") {
- displayContainer(id);
- }
- });
- }
-
-
-
-
-
-
-
-