mirror of
https://github.com/standardebooks/web.git
synced 2025-07-13 01:52:02 -04:00
Add comments and tweak formatting
This commit is contained in:
parent
f6aef54767
commit
2122b0f625
2 changed files with 5 additions and 3 deletions
|
@ -5,7 +5,9 @@ use Safe\DateTimeImmutable;
|
||||||
class EbookDownloadSummary{
|
class EbookDownloadSummary{
|
||||||
public int $EbookId;
|
public int $EbookId;
|
||||||
public DateTimeImmutable $Date;
|
public DateTimeImmutable $Date;
|
||||||
|
/** The number of downloads by non-bot clients on the given date. */
|
||||||
public int $DownloadCount = 0;
|
public int $DownloadCount = 0;
|
||||||
|
/** The number of downloads by bot clients on the given date. */
|
||||||
public int $BotDownloadCount = 0;
|
public int $BotDownloadCount = 0;
|
||||||
|
|
||||||
public function __construct(int $ebookId, DateTimeImmutable $date){
|
public function __construct(int $ebookId, DateTimeImmutable $date){
|
||||||
|
|
|
@ -35,9 +35,9 @@ foreach($downloadDates as $date){
|
||||||
Db::Query('
|
Db::Query('
|
||||||
UPDATE Ebooks e
|
UPDATE Ebooks e
|
||||||
left join (
|
left join (
|
||||||
select EbookId, sum(DownloadCount) AS DownloadsPast30Days
|
select EbookId, sum(DownloadCount) as DownloadsPast30Days
|
||||||
from EbookDownloadSummaries
|
from EbookDownloadSummaries
|
||||||
where Date >= curdate() - interval 29 day
|
where Date >= date(utc_timetamp()) - interval 30 day
|
||||||
group by EbookId
|
group by EbookId
|
||||||
) s on e.EbookId = s.EbookId
|
) s on e.EbookId = s.EbookId
|
||||||
set e.DownloadsPast30Days = coalesce(s.DownloadsPast30Days, 0)
|
set e.DownloadsPast30Days = coalesce(s.DownloadsPast30Days, 0)
|
||||||
|
@ -46,7 +46,7 @@ Db::Query('
|
||||||
Db::Query('
|
Db::Query('
|
||||||
UPDATE Ebooks e
|
UPDATE Ebooks e
|
||||||
left join (
|
left join (
|
||||||
select EbookId, sum(DownloadCount) AS DownloadsTotal
|
select EbookId, sum(DownloadCount) as DownloadsTotal
|
||||||
from EbookDownloadSummaries
|
from EbookDownloadSummaries
|
||||||
group by EbookId
|
group by EbookId
|
||||||
) s on e.EbookId = s.EbookId
|
) s on e.EbookId = s.EbookId
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue