Skip to content
  • P
    Projects
  • G
    Groups
  • S
    Snippets
  • Help

yotta / pictogram

  • This project
    • Loading...
  • Sign in
Go to a project
  • Project
  • Repository
  • Issues 60
  • Merge Requests 0
  • Pipelines
  • Wiki
  • Settings
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Closed
Open
Issue #368 opened Nov 04, 2017 by Sebastián Collado Montañez@scollado 
  • New issue
New issue

Stu_pictos que no aparecen

En DEV, probando la adaptación de los nuevos tableros me encuentro con el siguiente problema:

  • Estudiante 64 tiene asignados 14 stu_pictos sobre "Escena 2" (id: 192), sin embargo sólo dispone de 12 pictogramas visibles en el tablero.

  • select * from stu_picto where id_stu=64 me devuelve 1171 filas, pero he contado todos los pictogramas... y me salen unos 400 en total.

Pendiente:

  • Revisar otras "escenas" para sacar alguna conclusión (¿demasiados cambios sobre DEV?).
  • Con este estado en la base de datos es complicado que el script de adaptación a "tableros" funcione, buscar soluciones.
Edited Nov 06, 2017 by Sebastián Collado Montañez
  • Sebastián Collado Montañez @scollado

    changed the description

    Nov 06, 2017

    changed the description

    changed the description
    Toggle commit list
  • Sebastián Collado Montañez @scollado commented Nov 06, 2017
    Developer

    Cuando se borra una escena, los stu_picto asociados no se eliminan.

    Cuando se borra una escena, los stu_picto asociados no se eliminan.
  • Sebastián Collado Montañez @scollado commented Nov 06, 2017
    Developer

    Éste es el create table que debería estar en DEV, pero no está de ese modo.

    CREATE TABLE `stu_picto` (
      `id` int(11) NOT NULL AUTO_INCREMENT,
      `id_stu` int(11) NOT NULL,
      `id_pic` int(11) NOT NULL,
      `attributes` varchar(1000) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'JSON object describing the properties of the picto',
      `id_scene` int(11) NOT NULL,
      `id_child_scene` int(11) NULL;
      PRIMARY KEY (`id`),
      KEY `fk_picto` (`id_pic`),
      KEY `id_stu` (`id_stu`),
      KEY `stu_picto_grid_fk` (`id_grid`),
      CONSTRAINT `fk_picto` FOREIGN KEY (`id_pic`) REFERENCES `picto` (`id`),
      CONSTRAINT `stu_picto_ibfk_1` FOREIGN KEY (`id_stu`) REFERENCES `student` (`id`),
      CONSTRAINT `stu_picto_grid_fk` FOREIGN KEY (`id_grid`) REFERENCES `scene` (`id`) ON DELETE CASCADE
    ) ENGINE=InnoDB AUTO_INCREMENT=7010 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='This table relates a student with the pictos in her vocabulary';
    Edited Nov 06, 2017 by Sebastián Collado Montañez
    Éste es el create table que debería estar en DEV, pero no está de ese modo. ``` CREATE TABLE `stu_picto` ( `id` int(11) NOT NULL AUTO_INCREMENT, `id_stu` int(11) NOT NULL, `id_pic` int(11) NOT NULL, `attributes` varchar(1000) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'JSON object describing the properties of the picto', `id_scene` int(11) NOT NULL, `id_child_scene` int(11) NULL; PRIMARY KEY (`id`), KEY `fk_picto` (`id_pic`), KEY `id_stu` (`id_stu`), KEY `stu_picto_grid_fk` (`id_grid`), CONSTRAINT `fk_picto` FOREIGN KEY (`id_pic`) REFERENCES `picto` (`id`), CONSTRAINT `stu_picto_ibfk_1` FOREIGN KEY (`id_stu`) REFERENCES `student` (`id`), CONSTRAINT `stu_picto_grid_fk` FOREIGN KEY (`id_grid`) REFERENCES `scene` (`id`) ON DELETE CASCADE ) ENGINE=InnoDB AUTO_INCREMENT=7010 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='This table relates a student with the pictos in her vocabulary'; ```
  • Sebastián Collado Montañez @scollado commented Nov 06, 2017
    Developer

    Parece que cuando se actualizó al sistema de escenas y aplicar el CHANGES.md una línea no terminó correctamente por existir referencias a dichas columnas.

    `ALTER TABLE `stu_picto` ADD CONSTRAINT `stu_picto_scene_fk`
    FOREIGN KEY (`id_scene`) REFERENCES `scene` (`id`) ON DELETE CASCADE;`

    (si hay problema al añadir la foreign key, hacer SET FOREIGN_KEY_CHECKS = 0; antes de añadirla y SET FOREIGN_KEY_CHECKS = 1; después)

    Edited Nov 06, 2017 by Sebastián Collado Montañez
    Parece que cuando se actualizó al sistema de escenas y aplicar el CHANGES.md una línea no terminó correctamente por existir referencias a dichas columnas. ```sql `ALTER TABLE `stu_picto` ADD CONSTRAINT `stu_picto_scene_fk` FOREIGN KEY (`id_scene`) REFERENCES `scene` (`id`) ON DELETE CASCADE;` ``` (si hay problema al añadir la foreign key, hacer SET FOREIGN_KEY_CHECKS = 0; antes de añadirla y SET FOREIGN_KEY_CHECKS = 1; después)
  • Sebastián Collado Montañez @scollado commented Nov 06, 2017
    Developer

    Posible solución:

    Deshabilitar comprobaciones de clave ajena:

    SET FOREIGN_KEY_CHECKS = 0

    Eliminación de stu_pictos que no deberían existir:

    DELETE FROM `stu_picto`
    WHERE `id_scene` NOT IN (SELECT `s.id` FROM `scene` s);

    Añadir la restricción sobre la tabla stu_picto:

    ALTER TABLE `stu_picto` ADD CONSTRAINT `stu_picto_scene_fk`
    FOREIGN KEY (`id_scene`) REFERENCES `scene` (`id`) ON DELETE CASCADE;

    Volver a habilitar las comprobaciones de clave ajena:

    SET FOREIGN_KEY_CHECKS = 1
    Edited Nov 06, 2017 by Sebastián Collado Montañez
    ### Posible solución: Deshabilitar comprobaciones de clave ajena: ```sql SET FOREIGN_KEY_CHECKS = 0 ``` Eliminación de stu_pictos que no deberían existir: ```sql DELETE FROM `stu_picto` WHERE `id_scene` NOT IN (SELECT `s.id` FROM `scene` s); ``` Añadir la restricción sobre la tabla `stu_picto`: ```sql ALTER TABLE `stu_picto` ADD CONSTRAINT `stu_picto_scene_fk` FOREIGN KEY (`id_scene`) REFERENCES `scene` (`id`) ON DELETE CASCADE; ``` Volver a habilitar las comprobaciones de clave ajena: ```sql SET FOREIGN_KEY_CHECKS = 1 ```
  • Sebastián Collado Montañez @scollado

    closed

    Nov 09, 2017

    closed

    closed
    Toggle commit list
  • Write
  • Preview
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment
Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
No due date
0
Labels
None
Assign labels
  • View labels
1
1 participant
Reference: yotta/pictogram#368