• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Building and optimising a voting app with CI

#1
[eluser]_just_me[/eluser]
Hello,

I'd appreciate any help you can offer, though not sure if is more suited for a SQL forum - I'm currently trying to decide on a schema for a voting app I'm building in CI + MySQL, but I'm completely stuck on how to optimise it. The key elements are to allow only one vote per user per item, and be able to build a chart detailing the top items of the month – based on votes received that month.

So far the initial schema is:

Items_table
item_id
total_points
(lots of other fields unrelated to voting)

voting_table
voting_id
item_id
user_id
vote (1 = up; 0 = down)
month_cast
Year_cast

So I'm wondering if it's going to be a case of selecting all information from voting table where month = currentMonth & year = currentYear, somehow running a count and grouping by item_id; if so, how would I go about doing so? Or would I be better off creating a separate table for monthly charts which is updated with each vote, but then should I be concerned with the requirement to update 3 database tables per vote?

I'm not particularly competent – if it shows! – so would really love any help / guidance someone could provide.

Thanks,
_just_me

#2
[eluser]alexaaaaaaaaaa[/eluser]
Hey i've started a similar project if you want i can help you Smile
Here's the short history
polls
private (only users that are invited)
public all users can vote
state only users from a particular state can vote

poll image (user upload a picture)
poll video (user upload a video)
poll text simple

multiple choices

show votes
chart votes
facebook twitter login
account settings
logout
edit profile (in one word a3m auth)
album photos
album videos
events create
and much more...basiclly it's a social network build around the poll voting sistem very complex.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.