Browse Source

Create gradebook_score_log table - refs BT#9881 #TMI

Angel Fernando Quiroz Campos 9 years ago
parent
commit
2b8913b793

+ 1 - 0
main/inc/lib/database.constants.inc.php

@@ -56,6 +56,7 @@ define('TABLE_MAIN_GRADEBOOK_RESULT_LOG', 'gradebook_result_log');
 define('TABLE_MAIN_GRADEBOOK_LINK', 'gradebook_link');
 define('TABLE_MAIN_GRADEBOOK_SCORE_DISPLAY', 'gradebook_score_display');
 define('TABLE_MAIN_GRADEBOOK_CERTIFICATE', 'gradebook_certificate');
+define('TABLE_MAIN_GRADEBOOK_SCORE_LOG', 'gradebook_score_log');
 
 // Profiling
 

+ 163 - 0
src/Chamilo/CoreBundle/Entity/GradebookScoreLog.php

@@ -0,0 +1,163 @@
+<?php
+/* For licensing terms, see /license.txt */
+/**
+ * GradebookScoreLog
+ *
+ * @ORM\Table(
+ *      name="gradebook_score_log", indexes={
+ *          @ORM\Index(name="idx_gradebook_score_log_user", columns={"user_id"}),
+ *          @ORM\Index(name="idx_gradebook_score_log_user_category", columns={"user_id", "category_id"})
+ *      }
+ * )
+ * @ORM\Entity
+ */
+namespace Chamilo\CoreBundle\Entity;
+
+use Doctrine\ORM\Mapping as ORM;
+
+class GradebookScoreLog
+{
+
+    /**
+     * @var integer
+     *
+     * @ORM\Column(name="category_id", type="integer", nullable=false)
+     */
+    private $categoryId;
+
+    /**
+     * @var integer
+     *
+     * @ORM\Column(name="user_id", type="integer", nullable=false)
+     */
+    private $userId;
+
+    /**
+     * @var float
+     *
+     * @ORM\Column(name="score", type="float", precision=10, scale=0, nullable=false)
+     */
+    private $score;
+
+    /**
+     * @var \DateTime
+     *
+     * @ORM\Column(name="registered_at", type="datetime", nullable=false)
+     */
+    private $registeredAt;
+
+    /**
+     * @var integer
+     *
+     * @ORM\Column(name="id", type="integer")
+     * @ORM\Id
+     * @ORM\GeneratedValue(strategy="IDENTITY")
+     */
+    private $id;
+
+    /**
+     * Get the category id
+     * @return type
+     */
+    public function getCategoryId()
+    {
+        return $this->categoryId;
+    }
+
+    /**
+     * Get the user id
+     * @return type
+     */
+    public function getUserId()
+    {
+        return $this->userId;
+    }
+
+    /**
+     * Get the achieved score
+     * @return float
+     */
+    public function getScore()
+    {
+        return $this->score;
+    }
+
+    /**
+     * Get the datetime of register
+     * @return \DateTime
+     */
+    public function getRegisteredAt()
+    {
+        return $this->registeredAt;
+    }
+
+    /**
+     * Get the id
+     * @return integer
+     */
+    public function getId()
+    {
+        return $this->id;
+    }
+
+    /**
+     * Set the category id
+     * @param type $categoryId
+     * @return \Chamilo\CoreBundle\Entity\GradebookUserLog
+     */
+    public function setCategoryId($categoryId)
+    {
+        $this->categoryId = $categoryId;
+
+        return $this;
+    }
+
+    /**
+     * Set the user id
+     * @param type $userId
+     * @return \Chamilo\CoreBundle\Entity\GradebookUserLog
+     */
+    public function setUserId($userId)
+    {
+        $this->userId = $userId;
+
+        return $this;
+    }
+
+    /**
+     * Set the achieved score
+     * @param type $score
+     * @return \Chamilo\CoreBundle\Entity\GradebookUserLog
+     */
+    public function setScore($score)
+    {
+        $this->score = $score;
+
+        return $this;
+    }
+
+    /**
+     * Set the datetime of register
+     * @param \DateTime $registeredAt
+     * @return \Chamilo\CoreBundle\Entity\GradebookUserLog
+     */
+    public function setRegisteredAt(\DateTime $registeredAt)
+    {
+        $this->registeredAt = $registeredAt;
+
+        return $this;
+    }
+
+    /**
+     * Set the id
+     * @param type $id
+     * @return \Chamilo\CoreBundle\Entity\GradebookUserLog
+     */
+    public function setId($id)
+    {
+        $this->id = $id;
+
+        return $this;
+    }
+
+}

+ 65 - 0
src/Chamilo/CoreBundle/Migrations/Schema/V110/Version20150529164400.php

@@ -0,0 +1,65 @@
+<?php
+/* For licensing terms, see /license.txt */
+
+namespace Chamilo\CoreBundle\Migrations\Schema\V110;
+
+use Chamilo\CoreBundle\Migrations\AbstractMigrationChamilo;
+use Doctrine\DBAL\Schema\Schema;
+use Doctrine\DBAL\Types\Type as TableColumnType;
+
+/**
+ * Session date changes
+ */
+class Version20150529164400 extends AbstractMigrationChamilo
+{
+    /**
+     * @param Schema $schema
+     */
+    public function up(Schema $schema)
+    {
+        $gradebookScoreLog = $schema->createTable('gradebook_score_log');
+        $gradebookScoreLog->addColumn(
+            'id',
+            TableColumnType::INTEGER,
+            ['unsigned' => true, 'autoincrement' => true, 'notnull' => true]
+        );
+        $gradebookScoreLog->addColumn(
+            'category_id',
+            TableColumnType::INTEGER,
+            ['unsigned' => true, 'notnull' => true]
+        );
+        $gradebookScoreLog->addColumn(
+            'user_id',
+            TableColumnType::INTEGER,
+            ['unsigned' => true, 'notnull' => true]
+        );
+        $gradebookScoreLog->addColumn(
+            'score',
+            TableColumnType::FLOAT,
+            ['notnull' => true, 'scale' => 0, 'precision' => 10]
+        );
+        $gradebookScoreLog->addColumn(
+            'registered_at',
+            TableColumnType::DATETIME,
+            ['notnull' => true]
+        );
+        $gradebookScoreLog->setPrimaryKey(['id']);
+        $gradebookScoreLog->addIndex(
+            ['user_id'],
+            'idx_gradebook_score_log_user'
+        );
+        $gradebookScoreLog->addIndex(
+            ['user_id', 'category_id'],
+            'idx_gradebook_score_log_user_category'
+        );
+    }
+
+    /**
+     * @param Schema $schema
+     */
+    public function down(Schema $schema)
+    {
+        $schema->dropTable('gradebook_score_log');
+    }
+
+}