Libreria di queries
Libreria di queriesVisualizzare il numero di commenti per diversi periodi di tempo

Visualizzare il numero di commenti per diversi periodi di tempo

Questa query recupera il numero di commenti aggiunti al sito in diversi periodi di tempo:

  • nelle ultime 24 ore
  • negli ultimi 30 giorni
  • nell'ultimo anno
  • dall'inizio del mese
  • dall'inizio dell'anno
query GetCommentsForDifferentPeriodsOfTime {
  timeNow: _time  
  time24HsAgo: _intSubtract(subtract: 86400, from: $__timeNow)
  date24HsAgo: _date(format: "Y-m-d\\TH:i:sO", timestamp: $__time24HsAgo)  
  time1MonthAgo: _intSubtract(subtract: 2592000, from: $__timeNow)
  date1MonthAgo: _date(format: "Y-m-d\\TH:i:sO", timestamp: $__time1MonthAgo)
  time1YearAgo: _intSubtract(subtract: 31536000, from: $__timeNow)
  date1YearAgo: _date(format: "Y-m-d\\TH:i:sO", timestamp: $__time1YearAgo)
  timeBegOfThisMonth: _makeTime(hour: 0, minute: 0, second: 0, day: 1)
  dateBegOfThisMonth: _date(format: "Y-m-d\\TH:i:sO", timestamp: $__timeBegOfThisMonth)
  timeBegOfThisYear: _makeTime(hour: 0, minute: 0, second: 0, month: 1, day: 1)
  dateBegOfThisYear: _date(format: "Y-m-d\\TH:i:sO", timestamp: $__timeBegOfThisYear)
  
  commentsAddedInLast24Hs: commentCount(filter: { dateQuery: { after: $__date24HsAgo } } )  
  commentsAddedInLast1Month: commentCount(filter: { dateQuery: { after: $__date1MonthAgo } } )  
  commentsAddedInLast1Year: commentCount(filter: { dateQuery: { after: $__date1YearAgo } } )  
  commentsAddedSinceBegOfThisMonth: commentCount(filter: { dateQuery: { after: $__dateBegOfThisMonth } } )  
  commentsAddedSinceBegOfThisYear: commentCount(filter: { dateQuery: { after: $__dateBegOfThisYear } } )
}