Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add weekly citations report #6238

Closed
garethrees opened this issue May 10, 2021 · 5 comments
Closed

Add weekly citations report #6238

garethrees opened this issue May 10, 2021 · 5 comments
Labels
enhancement Adds new functionality f:request-analysis stale Issues with no activity for 12 months x:uk

Comments

@garethrees
Copy link
Member

We currently run some code in the console to have a look at the latest citations.

# Added in the last week
Citation.
  where(created_at: (Time.now.beginning_of_week-1.week)..Time.now.beginning_of_week).
  map { |c| "https://www.whatdotheyknow.com/request/" + c.citable.url_title }.
  uniq

It would be good to create a periodic digest email to the admin addresses to see what gets mentioned.

We're currently interested in:

  • The URL of the FOI request
  • The URL of the citable
  • Whether the user was pro at the time of making the request
  • Whether the request currently has an embargo
@sallytay
Copy link

It would be useful to have this feature to allow us to see what requests have received 'in the news' citations to more easily identify good use of the service

Sally

@gbp
Copy link
Member

gbp commented Nov 22, 2021

range = (Time.now.beginning_of_week-1.week)..Time.now.beginning_of_week

def pro_citation?(citation)
  return true if citation.citable.is_a?(InfoRequestBatch)

  pro_account = citation.citable.user.pro_account
  return false unless pro_account

  subscriptions = Stripe::Subscription.list(
    status: 'all', customer: pro_account.stripe_customer_id
  )

  ranges = subscriptions.map do |s|
    started_at = Time.at(s.created)
    ended_at = Time.at(s.ended_at) if s.ended_at
    ended_at ||= Time.now

    started_at..ended_at
  end

  ranges.any? { |r| r.include?(citation.created_at) }
end

Citation.where(created_at: range).uniq.map do |c|
  pro = pro_citation?(c) ? 'PRO: ' : 'NOT-PRO: '
  puts pro + "https://www.whatdotheyknow.com/request/" + c.citable.url_title
end

@RichardTaylor
Copy link

We're currently interested in:

It might be worth looking at who is adding the citations - to look to see if requesters are being effectively encouraged to add their own, and to surface some potentially more hidden work done by volunteers.

Related: #6620 Public credit for individuals who added "in the news" links

@garethrees
Copy link
Member Author

Noting an updated version of the export script at https://github.com/mysociety/alaveteli/wiki/Export-citations.

@HelenWDTK HelenWDTK added the stale Issues with no activity for 12 months label Nov 19, 2024
@HelenWDTK
Copy link
Contributor

This issue has been automatically closed due to a lack of discussion or resolution for over 12 months.
Should we decide to revisit this issue in the future, it can be reopened.

@HelenWDTK HelenWDTK closed this as not planned Won't fix, can't repro, duplicate, stale Nov 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Adds new functionality f:request-analysis stale Issues with no activity for 12 months x:uk
Projects
None yet
Development

No branches or pull requests

5 participants