Purpose
The purpose of this page is to let users input their suggestions of what's missing in PPI, and let people vote on these ideas, similar to stack overflow, where the item with the most votes is at the top.
Implementation
-
The route for this should be at /ideas (/modules/Application/resources/config/routes.yml)
-
This should be mapped to an Ideas controller (Application/Controller/Ideas.php)
-
There should be an ideas database table containing fields. id, title, vote_score
3.1) There should be a Storage class to map to the ideas table named: Application/Storage/Ideas.php
3.2) Their should be an Application\Entity\Idea class to be returned by the above Storage class
-
The issue of duplication should be avoided, so we need to match on IP Address and cookie, thus a second database table is needed.
4.1) DB table named: ideas_votes with fields. id, idea_id, ip_address this will let us determine if a user of a specific ip_address has already voted on this idea_id before.
4.2) A cookie will be set on this named ppi_idea_x where X is the ID of the idea, this will let them still vote on multiple ideas.
-
When someone is voting it will maintain the ideas.vote_score field, either incrementing or decrementing the value.
5.1) When displaying the ideas a simple ORDER BY ideas.vote_score DESC will be enough to show ideas with the highest votes.
Purpose
The purpose of this page is to let users input their suggestions of what's missing in PPI, and let people vote on these ideas, similar to stack overflow, where the item with the most votes is at the top.
Implementation
The route for this should be at /ideas (
/modules/Application/resources/config/routes.yml)This should be mapped to an Ideas controller (
Application/Controller/Ideas.php)There should be an
ideasdatabase table containing fields.id, title, vote_score3.1) There should be a Storage class to map to the
ideastable named:Application/Storage/Ideas.php3.2) Their should be an
Application\Entity\Ideaclass to be returned by the above Storage classThe issue of duplication should be avoided, so we need to match on IP Address and cookie, thus a second database table is needed.
4.1) DB table named:
ideas_voteswith fields.id, idea_id, ip_addressthis will let us determine if a user of a specific ip_address has already voted on thisidea_idbefore.4.2) A cookie will be set on this named
ppi_idea_xwhere X is the ID of the idea, this will let them still vote on multiple ideas.When someone is voting it will maintain the
ideas.vote_scorefield, either incrementing or decrementing the value.5.1) When displaying the ideas a simple
ORDER BY ideas.vote_score DESCwill be enough to show ideas with the highest votes.