<p>It looks like the Entry Count plugin could potentially serve your needs, though you'd need to make a few changes for it to behave the way you want. Natively, it looks like the counts are just lumped together for each entry.</p>

<p><a href="https://craftpl.us/plugins/upvote" rel="nofollow noreferrer">Upvote</a> is perfect for checking recent votes! <em>(Disclaimer: I'm the author of Upvote.)</em></p>

<p>With Upvote, you can see if an entry was voted on in the past 24 hours, simply by checking the <code>craft_upvote_elementtallies.dateUpdated</code> value in the database.</p>

<p><a href="https://i.sstatic.net/dbgjZ.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/dbgjZ.png" alt="craft_upvote_elementtallies"></a></p>

<p>If that's not detailed enough, you can enable the option to <strong>"Keep a detailed record of all votes"</strong>. This gives you a vote-by-vote report of every single upvote/downvote ever cast. The detailed log is stored separately in the <code>craft_upvote_votelog</code> table.</p>

<p><a href="https://i.sstatic.net/rNpRk.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/rNpRk.png" alt="craft_upvote_votelog"></a></p>

<blockquote>
  <p><strong>Warning:</strong> An unchecked <code>craft_upvote_votelog</code> table can grow rapidly, and quickly swell the size of your database. If you only need it to check up on <em>recent</em> votes, feel free to set a cron job to frequently delete old rows.</p>
</blockquote>

<p>The <code>craft_upvote_votelog</code> table is not critical for the day-to-day operations of Upvote. It's more of a "nice to have" for rare situations which could benefit from it (like in your scenario).</p>

CC BY-SA 3.0
2017-05-04T05:05:10.543Z
with upvote, is there a way to query the db for all votes cast in the last 24 hours using twig and find out which entries the votes are associated with?
ChaiTea
CC BY-SA 3.0
2017-05-04T05:06:25.190Z
Not with Twig directly, but it would be very easy to write a plugin to collect that information and make it available via Twig.
Lindsey D
CC BY-SA 3.0
2017-05-04T06:20:52.590Z
ok I think I need to go learn craft plugin dev first since I've never done one before. Will circle back on this one. So are there php functions or classes that the upvote plugin exposes that can query vote within last 24 hours and the associated entries? Will they return as an associate arrays that I can then export into twig tags?
ChaiTea
CC BY-SA 3.0
2017-05-04T14:06:35.273Z
We're starting to get a bit off topic from the original post... Feel free to email support@doublesecretagency.com, or DM me on Craft Slack (@lindseydiloreto), and I'd be happy to answer any additional questions on Upvote!
Lindsey D
CC BY-SA 3.0
2017-05-04T03:43:14.817Z
2017-05-04T03:43:14.817Z
Lindsey D
<p>I'm working on a typical craft blog with articles. I know there is a plugin that was used to teach craft plugin development that tracks entry visit counts here:</p>

<p><a href="https://straightupcraft.com/craft-plugins/entry-count" rel="nofollow noreferrer">https://straightupcraft.com/craft-plugins/entry-count</a></p>

<p>However, is there anyway to distinguish the visits made in the last 24 hours? The docs on this simple plugin doesn't talk about it. The logic would probably be take the view count now and subtract by the count from 24 hours ago. I'm guessing the view count might be a value in the mysql table that keeps getting updated. If each count is a row in the table then perhaps there are ways to just query the db for counts associated with an entry filtered by the time stamp. But I highly doubt thats how the plugin is implemented.</p>

<p>I also could use help tracking the posts with the highest upvotes using the upvote plugin:</p>

<p><a href="https://straightupcraft.com/craft-plugins/upvote" rel="nofollow noreferrer">https://straightupcraft.com/craft-plugins/upvote</a></p>

<p>I'm doing this to work out a trending logic. Trending posts are posts that have a combination of highest view count and upvotes in the last 24 hours.</p>

<plugins><datetime><php><mysql>
Entry view count in the last 24 hours
# Entry view count in the last 24 hours

(Asked by: username_0 on 2017-05-04)

I'm working on a typical craft blog with articles. I know there is a plugin that was used to teach craft plugin development that tracks entry visit counts here:

<https://straightupcraft.com/craft-plugins/entry-count>

However, is there anyway to distinguish the visits made in the last 24 hours? The docs on this simple plugin doesn't talk about it. The logic would probably be take the view count now and subtract by the count from 24 hours ago. I'm guessing the view count might be a value in the mysql table that keeps getting updated. If each count is a row in the table then perhaps there are ways to just query the db for counts associated with an entry filtered by the time stamp. But I highly doubt thats how the plugin is implemented.

I also could use help tracking the posts with the highest upvotes using the upvote plugin:

<https://straightupcraft.com/craft-plugins/upvote>

I'm doing this to work out a trending logic. Trending posts are posts that have a combination of highest view count and upvotes in the last 24 hours.

**Tags:** plugins, datetime, php, mysql


---

## 1 answers

### Answer by username_1 on 2017-05-04. Score: 2

It looks like the Entry Count plugin could potentially serve your needs, though you'd need to make a few changes for it to behave the way you want. Natively, it looks like the counts are just lumped together for each entry.

[Upvote](https://craftpl.us/plugins/upvote) is perfect for checking recent votes! *(Disclaimer: I'm the author of Upvote.)*

With Upvote, you can see if an entry was voted on in the past 24 hours, simply by checking the `craft_upvote_elementtallies.dateUpdated` value in the database.

[![craft_upvote_elementtallies](https://i.sstatic.net/dbgjZ.png)](https://i.sstatic.net/dbgjZ.png)

If that's not detailed enough, you can enable the option to **"Keep a detailed record of all votes"**. This gives you a vote-by-vote report of every single upvote/downvote ever cast. The detailed log is stored separately in the `craft_upvote_votelog` table.

[![craft_upvote_votelog](https://i.sstatic.net/rNpRk.png)](https://i.sstatic.net/rNpRk.png)

> **Warning:** An unchecked `craft_upvote_votelog` table can grow rapidly, and quickly swell the size of your database. If you only need it to check up on *recent* votes, feel free to set a cron job to frequently delete old rows.

The `craft_upvote_votelog` table is not critical for the day-to-day operations of Upvote. It's more of a "nice to have" for rare situations which could benefit from it (like in your scenario).

> **Comments:**
> **username_0**: with upvote, is there a way to query the db for all votes cast in the last 24 hours using twig and find out which entries the votes are associated with?  
> **username_1**: Not with Twig directly, but it would be very easy to write a plugin to collect that information and make it available via Twig.  
> **username_0**: ok I think I need to go learn craft plugin dev first since I've never done one before. Will circle back on this one. So are there php functions or classes that the upvote plugin exposes that can query vote within last 24 hours and the associated entries? Will they return as an associate arrays that I can then export into twig tags?  
> **username_1**: We're starting to get a bit off topic from the original post... Feel free to email support@doublesecretagency.com, or DM me on Craft Slack (@lindseydiloreto), and I'd be happy to answer any additional questions on Upvote!  

---

