Difference between revisions of "InstaGov/schema/rating"

from HTYP, the free directory anyone can edit if they can prove to me that they're not a spambot
Jump to navigation Jump to search
(Created page with '==About== * '''Concepts''': see {{instagov|concepts|proxy}} ==SQL== Records each user's current rating of each proposed solution. <section begin=sql /><mysql>CREATE TABLE `rating…')
 
(decided not to implement yet)
 
(9 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
==About==
 
==About==
* '''Concepts''': see {{instagov|concepts|proxy}}
+
* '''Purpose''': Records the current value of one user's {{igov/term|rating}} of a given {{igov/term|answer}} (which in turn is tied to a specific {{igov/term|question}}. These are the values which are aggregated to calculate the voting results for each question.
 +
* '''Rules''':
 +
** Any {{l/same|answer}} may have zero or more ratings.
 +
** Each user sets the value of their rating for each answer, and can change that rating at any time.
 +
** Changes to ratings are logged in the {{l/same|rating log}}.
 +
==History==
 +
* '''2013-01-09''' Removed the "ID_Proxy" field; see {{l/same|rating_log}} for explanation; added unique key: one rating per answer per user; added WhenEdited, QtyEdits
 +
* '''2013-08-05''' Designed new version for integrating with {{l/pferret}} (added ID_Atom, removed redundant fields) but decided not to implement yet, because value is not clear. Ratings already keep a separate log, and would we ever want to rate a rating? (...or do any of the other things that integration would enable)
 
==SQL==
 
==SQL==
Records each user's current rating of each proposed solution.
+
<mysql>CREATE TABLE `rating` (
<section begin=sql /><mysql>CREATE TABLE `rating` (
+
   `ID`         INT         NOT NULL AUTO_INCREMENT,
   `ID` INT NOT NULL AUTO_INCREMENT,
+
   `ID_User`     INT         NOT NULL COMMENT "ID of user who gave this rating",
   `ID_User` INT COMMENT "user.ID who gave this rating",
+
   `ID_Answer`   INT         NOT NULL COMMENT "ID of answer for which this is a rating",
   `ID_Answer` INT NOT NULL COMMENT "answer.ID for which this is a rating",
+
   `ID_Log`     INT         NOT NULL COMMENT "ID of log entry for the most recent update of this rating",
   `ID_Log` INT NOT NULL COMMENT "ID of log event which posted this value",
+
   `Value`       INT         NOT NULL COMMENT "rating value",
   `ID_Proxy` INT DEFAULT NULL COMMENT "if this approval was proxied, records which proxy was used",
+
   `WhenCreated` DATETIME    NOT NULL COMMENT "when this user first rated this answer",
   `Value` INT NOT NULL COMMENT "rating value",
+
   `WhenEdited` DATETIME DEFAULT NULL COMMENT "when this rating (of this answer) was last edited (by this user)",
   `WhenDone` DATETIME NOT NULL COMMENT "when this rating was posted",
+
  `QtyEdits`    INT      DEFAULT NULL COMMENT "number of times this rating has been edited",
   `Remark` VARCHAR(255) COMMENT "comments on this rating (can include link)",
+
   `Remark`     VARCHAR(255)         COMMENT "comments on this rating (can include link)",
   PRIMARY KEY(`ID`)
+
   PRIMARY KEY(`ID`),
 +
  UNIQUE KEY(`ID_User`,`ID_Answer`)
 +
)
 +
ENGINE = MYISAM;</mysql>
 +
==PostFerret version==
 +
<mysql>CREATE TABLE `rating` (
 +
  `ID_Atom`    INT              NOT NULL COMMENT "main ID",
 +
  `ID_User`    INT              NOT NULL COMMENT "ID of user who gave this rating",
 +
  `ID_Answer`  INT              NOT NULL COMMENT "ID of answer for which this is a rating",
 +
  `ID_Log`      INT              NOT NULL COMMENT "ID of log entry for the most recent update of this rating",
 +
  `Value`      INT              NOT NULL COMMENT "rating value",
 +
  `Remark`      VARCHAR(255) DEFAULT NULL COMMENT "comments on this rating",
 +
  PRIMARY KEY(`ID`),
 +
  UNIQUE KEY(`ID_User`,`ID_Answer`)
 
  )
 
  )
 
  ENGINE = MYISAM;</mysql>
 
  ENGINE = MYISAM;</mysql>
<section end=sql />
 

Latest revision as of 17:48, 5 August 2013

About

  • Purpose: Records the current value of one user's rating of a given answer (which in turn is tied to a specific question. These are the values which are aggregated to calculate the voting results for each question.
  • Rules:
    • Any answer may have zero or more ratings.
    • Each user sets the value of their rating for each answer, and can change that rating at any time.
    • Changes to ratings are logged in the rating log.

History

  • 2013-01-09 Removed the "ID_Proxy" field; see rating_log for explanation; added unique key: one rating per answer per user; added WhenEdited, QtyEdits
  • 2013-08-05 Designed new version for integrating with PostFerret (added ID_Atom, removed redundant fields) but decided not to implement yet, because value is not clear. Ratings already keep a separate log, and would we ever want to rate a rating? (...or do any of the other things that integration would enable)

SQL

<mysql>CREATE TABLE `rating` (

  `ID`          INT          NOT NULL AUTO_INCREMENT,
  `ID_User`     INT          NOT NULL COMMENT "ID of user who gave this rating",
  `ID_Answer`   INT          NOT NULL COMMENT "ID of answer for which this is a rating",
  `ID_Log`      INT          NOT NULL COMMENT "ID of log entry for the most recent update of this rating",
  `Value`       INT          NOT NULL COMMENT "rating value",
  `WhenCreated` DATETIME     NOT NULL COMMENT "when this user first rated this answer",
  `WhenEdited`  DATETIME DEFAULT NULL COMMENT "when this rating (of this answer) was last edited (by this user)",
  `QtyEdits`    INT      DEFAULT NULL COMMENT "number of times this rating has been edited",
  `Remark`      VARCHAR(255)          COMMENT "comments on this rating (can include link)",
  PRIMARY KEY(`ID`),
  UNIQUE KEY(`ID_User`,`ID_Answer`)
)
ENGINE = MYISAM;</mysql>

PostFerret version

<mysql>CREATE TABLE `rating` (

  `ID_Atom`     INT              NOT NULL COMMENT "main ID", 
  `ID_User`     INT              NOT NULL COMMENT "ID of user who gave this rating",
  `ID_Answer`   INT              NOT NULL COMMENT "ID of answer for which this is a rating",
  `ID_Log`      INT              NOT NULL COMMENT "ID of log entry for the most recent update of this rating",
  `Value`       INT              NOT NULL COMMENT "rating value",
  `Remark`      VARCHAR(255) DEFAULT NULL COMMENT "comments on this rating",
  PRIMARY KEY(`ID`),
  UNIQUE KEY(`ID_User`,`ID_Answer`)
)
ENGINE = MYISAM;</mysql>