Skip to content

Instantly share code, notes, and snippets.

@defong
Last active November 1, 2023 11:55
Show Gist options
  • Save defong/5f2f385136b2bdc37437fdb0ce754bfc to your computer and use it in GitHub Desktop.
Save defong/5f2f385136b2bdc37437fdb0ce754bfc to your computer and use it in GitHub Desktop.
[DfE] 6290-hertfordshire-uni-hesa-not-appearing-in-register
xml_response = Hesa::Client.get(url: "https://datacollection.hesa.ac.uk/apis/itt/1.1/CensusData/C23053/2023-10-26")
student_nodes = Nokogiri::XML::Reader(xml_response).filter_map do |node|
Nokogiri::XML(node.outer_xml).at("./Student") if node.name == "Student" && node.node_type == Nokogiri::XML::Reader::TYPE_ELEMENT
end
students = student_nodes.map do |student_node|
# student_attributes = Hash.from_xml(student_node.to_s)["Student"]
Hesa::Parsers::IttRecord.to_attributes(student_node:)
end
bob = 0
student_nodes.each_with_index do |student_node, index|
bob = index
Trainees::CreateFromHesa.call(student_node:, record_source: "bob 1")
end
url = "#{Settings.hesa.collection_base_url}/#{@collection_reference}/#{Hesa::CollectionRequest.next_from_date}"
url = "https://datacollection.hesa.ac.uk/apis/itt/1.1/CensusData/C23053/2023-10-30"
xml_response = Hesa::Client.get(url: )
students = Nokogiri::XML::Reader(Hesa::Client.get(url: )).filter_map do |node|
Hesa::Parsers::IttRecord.to_attributes(Nokogiri::XML(node.outer_xml).at("./Student")) if node.name == "Student" && node.node_type == Nokogiri::XML::Reader::TYPE_ELEMENT
end
students = student_nodes.map do |student_node|
# student_attributes = Hash.from_xml(student_node.to_s)["Student"]
Hesa::Parsers::IttRecord.to_attributes(student_node:)
end
found = students.filter_map do |student|
student if student[:hesa_id] == "23100078420003851"
end
Hesa::CollectionRequest.where(collection_reference: Settings.hesa.current_collection_reference).import_failed.order(created_at: :desc).limit(50).pluck(:created_at)
# [Thu, 19 Oct 2023 12:19:05.527766000 UTC +00:00,
# Thu, 19 Oct 2023 10:21:11.584213000 UTC +00:00,
# Thu, 19 Oct 2023 08:16:53.740247000 UTC +00:00,
# Wed, 18 Oct 2023 22:16:14.510166000 UTC +00:00,
# Wed, 18 Oct 2023 20:16:56.626917000 UTC +00:00,
# Wed, 18 Oct 2023 18:16:44.282409000 UTC +00:00,
# Wed, 18 Oct 2023 16:17:57.824600000 UTC +00:00,
# Wed, 18 Oct 2023 14:19:26.797960000 UTC +00:00,
# Wed, 18 Oct 2023 12:20:10.312580000 UTC +00:00,
# Wed, 18 Oct 2023 10:33:19.227157000 UTC +00:00,
# Wed, 18 Oct 2023 08:04:18.143466000 UTC +00:00,
# Tue, 17 Oct 2023 22:03:38.267433000 UTC +00:00,
# Tue, 17 Oct 2023 20:03:38.595450000 UTC +00:00,
# Tue, 17 Oct 2023 18:03:42.236703000 UTC +00:00,
# Tue, 17 Oct 2023 16:04:14.574580000 UTC +00:00,
# Tue, 17 Oct 2023 14:03:31.792663000 UTC +00:00]
Hesa::CollectionRequest.where(collection_reference: Settings.hesa.current_collection_reference).import_successful.order(created_at: :desc).limit(50).pluck(:created_at)
# [Tue, 17 Oct 2023 10:03:16.728906000 UTC +00:00,
# Tue, 17 Oct 2023 08:24:15.003495000 UTC +00:00,
# Mon, 16 Oct 2023 22:26:22.344518000 UTC +00:00,
# Mon, 16 Oct 2023 20:22:34.620742000 UTC +00:00,
# Mon, 16 Oct 2023 18:15:24.838579000 UTC +00:00,
# Mon, 16 Oct 2023 16:17:14.700160000 UTC +00:00,
# Mon, 16 Oct 2023 14:11:44.971174000 UTC +00:00,
# Mon, 16 Oct 2023 12:03:41.342746000 UTC +00:00,
# Mon, 16 Oct 2023 10:04:21.221765000 UTC +00:00,
# Mon, 16 Oct 2023 08:02:17.699189000 UTC +00:00,
# Sun, 15 Oct 2023 22:00:06.178697000 UTC +00:00,
# Sun, 15 Oct 2023 20:00:37.222362000 UTC +00:00,
# Sun, 15 Oct 2023 18:00:12.987301000 UTC +00:00,
# Sun, 15 Oct 2023 16:00:49.689015000 UTC +00:00,
# Sun, 15 Oct 2023 14:00:10.671957000 UTC +00:00,
# Sun, 15 Oct 2023 12:00:17.999123000 UTC +00:00,
# Sun, 15 Oct 2023 10:01:12.235267000 UTC +00:00,
# Sun, 15 Oct 2023 08:00:31.001152000 UTC +00:00,
# Sat, 14 Oct 2023 22:01:16.889892000 UTC +00:00,
# Sat, 14 Oct 2023 20:00:22.521222000 UTC +00:00,
# Sat, 14 Oct 2023 18:00:06.154863000 UTC +00:00,
# Sat, 14 Oct 2023 16:00:32.809884000 UTC +00:00,
# Sat, 14 Oct 2023 14:00:29.410830000 UTC +00:00,
# Sat, 14 Oct 2023 12:00:27.212981000 UTC +00:00,
# Sat, 14 Oct 2023 10:01:04.508818000 UTC +00:00,
# Sat, 14 Oct 2023 08:05:15.844374000 UTC +00:00,
# Fri, 13 Oct 2023 22:06:15.687737000 UTC +00:00,
# Fri, 13 Oct 2023 20:05:42.183254000 UTC +00:00,
# Fri, 13 Oct 2023 18:04:47.012618000 UTC +00:00,
# Fri, 13 Oct 2023 16:06:55.548882000 UTC +00:00,
# Fri, 13 Oct 2023 14:01:11.922338000 UTC +00:00,
# Fri, 13 Oct 2023 12:02:14.232478000 UTC +00:00,
# Fri, 13 Oct 2023 10:00:47.779921000 UTC +00:00,
# Fri, 13 Oct 2023 08:07:52.524645000 UTC +00:00,
# Thu, 12 Oct 2023 22:06:43.889007000 UTC +00:00,
# Thu, 12 Oct 2023 20:06:20.326622000 UTC +00:00,
# Thu, 12 Oct 2023 18:06:42.837427000 UTC +00:00,
# Thu, 12 Oct 2023 16:07:05.281750000 UTC +00:00,
# Thu, 12 Oct 2023 14:06:50.058309000 UTC +00:00,
# Thu, 12 Oct 2023 12:08:11.911421000 UTC +00:00,
# Thu, 12 Oct 2023 10:09:55.112273000 UTC +00:00,
# Thu, 12 Oct 2023 08:02:15.694896000 UTC +00:00,
# Wed, 11 Oct 2023 22:00:28.975169000 UTC +00:00,
# Wed, 11 Oct 2023 20:00:25.322838000 UTC +00:00,
# Wed, 11 Oct 2023 18:00:30.501997000 UTC +00:00,
# Wed, 11 Oct 2023 16:00:31.308002000 UTC +00:00,
# Wed, 11 Oct 2023 14:00:47.341054000 UTC +00:00,
# Wed, 11 Oct 2023 12:00:49.824460000 UTC +00:00,
# Wed, 11 Oct 2023 10:00:47.532092000 UTC +00:00,
# Wed, 11 Oct 2023 08:02:22.425165000 UTC +00:00]
[*(18.months.ago.to_date..DateTime.now)].reverse.filter_map do |date|
[date, Hesa::CollectionRequest.where(created_at: date.beginning_of_day..date.end_of_day).count] if Hesa::CollectionRequest.where(created_at: date.beginning_of_day..date.end_of_day).count >= 12
end.first
[*(18.months.ago.to_date..DateTime.now)].reverse.map do |date|
[date, Hesa::CollectionRequest.where(created_at: date.beginning_of_day..date.end_of_day).count]
end
# [[Tue, 24 Oct 2023, 0],
# [Mon, 23 Oct 2023, 0],
# [Sun, 22 Oct 2023, 0],
# [Sat, 21 Oct 2023, 0],
# [Fri, 20 Oct 2023, 0],
# [Thu, 19 Oct 2023, 3],
# [Wed, 18 Oct 2023, 8],
# [Tue, 17 Oct 2023, 7],
# [Mon, 16 Oct 2023, 8],
# [Sun, 15 Oct 2023, 8],
# [Sat, 14 Oct 2023, 8],
# [Fri, 13 Oct 2023, 8],
# [Thu, 12 Oct 2023, 8],
# [Wed, 11 Oct 2023, 8],
# [Tue, 10 Oct 2023, 8],
# [Mon, 09 Oct 2023, 8],
# [Sun, 08 Oct 2023, 8],
# [Sat, 07 Oct 2023, 8],
# [Fri, 06 Oct 2023, 8],
# [Thu, 05 Oct 2023, 8],
# [Wed, 04 Oct 2023, 8],
# [Tue, 03 Oct 2023, 12],
# [Mon, 02 Oct 2023, 12],
# [Sun, 01 Oct 2023, 12],
# [Sat, 30 Sep 2023, 12],
# [Fri, 29 Sep 2023, 12],
# [Thu, 28 Sep 2023, 12],
# [Wed, 27 Sep 2023, 12],
# [Tue, 26 Sep 2023, 12],
# [Mon, 25 Sep 2023, 12],
# [Sun, 24 Sep 2023, 12],
# [Sat, 23 Sep 2023, 12],
# [Fri, 22 Sep 2023, 12],
# [Thu, 21 Sep 2023, 12],
# [Wed, 20 Sep 2023, 12],
# [Tue, 19 Sep 2023, 12],
# [Mon, 18 Sep 2023, 12],
# [Sun, 17 Sep 2023, 12],
# [Sat, 16 Sep 2023, 12],
# [Fri, 15 Sep 2023, 12],
# [Thu, 14 Sep 2023, 12],
# [Wed, 13 Sep 2023, 12],
# [Tue, 12 Sep 2023, 12],
# [Mon, 11 Sep 2023, 12],
# [Sun, 10 Sep 2023, 12],
# [Sat, 09 Sep 2023, 12],
# [Fri, 08 Sep 2023, 12],
# [Thu, 07 Sep 2023, 5],
# [Wed, 06 Sep 2023, 1],
# [Tue, 05 Sep 2023, 0],
# [Mon, 04 Sep 2023, 0],
# [Sun, 03 Sep 2023, 0],
# [Sat, 02 Sep 2023, 0],
# [Fri, 01 Sep 2023, 0],
# [Thu, 31 Aug 2023, 0],
# [Wed, 30 Aug 2023, 0],
# [Tue, 29 Aug 2023, 0],
# [Mon, 28 Aug 2023, 0],
# [Sun, 27 Aug 2023, 0],
# [Sat, 26 Aug 2023, 0],
# [Fri, 25 Aug 2023, 0],
# [Thu, 24 Aug 2023, 0],
# [Wed, 23 Aug 2023, 0],
# [Tue, 22 Aug 2023, 0],
# [Mon, 21 Aug 2023, 0],
# [Sun, 20 Aug 2023, 0],
# [Sat, 19 Aug 2023, 0],
# [Fri, 18 Aug 2023, 0],
# [Thu, 17 Aug 2023, 0],
# [Wed, 16 Aug 2023, 0],
# [Tue, 15 Aug 2023, 0],
# [Mon, 14 Aug 2023, 0],
# [Sun, 13 Aug 2023, 0],
# [Sat, 12 Aug 2023, 0],
# [Fri, 11 Aug 2023, 4],
# [Thu, 10 Aug 2023, 12],
# [Wed, 09 Aug 2023, 12],
# [Tue, 08 Aug 2023, 12],
# [Mon, 07 Aug 2023, 12],
# [Sun, 06 Aug 2023, 12],
# [Sat, 05 Aug 2023, 12],
# [Fri, 04 Aug 2023, 12],
# [Thu, 03 Aug 2023, 12],
# [Wed, 02 Aug 2023, 12],
# [Tue, 01 Aug 2023, 12],
# [Mon, 31 Jul 2023, 12],
# [Sun, 30 Jul 2023, 12],
# [Sat, 29 Jul 2023, 12],
# [Fri, 28 Jul 2023, 12],
# [Thu, 27 Jul 2023, 12],
# [Wed, 26 Jul 2023, 12],
# [Tue, 25 Jul 2023, 12],
# [Mon, 24 Jul 2023, 12],
# [Sun, 23 Jul 2023, 12],
# [Sat, 22 Jul 2023, 12],
# [Fri, 21 Jul 2023, 12],
# [Thu, 20 Jul 2023, 12],
# [Wed, 19 Jul 2023, 11],
# [Tue, 18 Jul 2023, 12],
# [Mon, 17 Jul 2023, 12],
# [Sun, 16 Jul 2023, 12],
# [Sat, 15 Jul 2023, 12],
# [Fri, 14 Jul 2023, 12],
# [Thu, 13 Jul 2023, 12],
# [Wed, 12 Jul 2023, 12],
# [Tue, 11 Jul 2023, 12],
# [Mon, 10 Jul 2023, 12],
# [Sun, 09 Jul 2023, 12],
# [Sat, 08 Jul 2023, 12],
# [Fri, 07 Jul 2023, 12],
# [Thu, 06 Jul 2023, 12],
# [Wed, 05 Jul 2023, 12],
# [Tue, 04 Jul 2023, 12],
# [Mon, 03 Jul 2023, 12],
# [Sun, 02 Jul 2023, 12],
# [Sat, 01 Jul 2023, 12],
# [Fri, 30 Jun 2023, 12],
# [Thu, 29 Jun 2023, 12],
# [Wed, 28 Jun 2023, 12],
# [Tue, 27 Jun 2023, 12],
# [Mon, 26 Jun 2023, 12],
# [Sun, 25 Jun 2023, 12],
# [Sat, 24 Jun 2023, 12],
# [Fri, 23 Jun 2023, 11],
# [Thu, 22 Jun 2023, 12],
# [Wed, 21 Jun 2023, 12],
# [Tue, 20 Jun 2023, 12],
# [Mon, 19 Jun 2023, 12],
# [Sun, 18 Jun 2023, 12],
# [Sat, 17 Jun 2023, 12],
# [Fri, 16 Jun 2023, 12],
# [Thu, 15 Jun 2023, 12],
# [Wed, 14 Jun 2023, 12],
# [Tue, 13 Jun 2023, 12],
# [Mon, 12 Jun 2023, 12],
# [Sun, 11 Jun 2023, 12],
# [Sat, 10 Jun 2023, 12],
# [Fri, 09 Jun 2023, 12],
# [Thu, 08 Jun 2023, 12],
# [Wed, 07 Jun 2023, 12],
# [Tue, 06 Jun 2023, 12],
# [Mon, 05 Jun 2023, 12],
# [Sun, 04 Jun 2023, 12],
# [Sat, 03 Jun 2023, 12],
# [Fri, 02 Jun 2023, 12],
# [Thu, 01 Jun 2023, 12],
# [Wed, 31 May 2023, 12],
# [Tue, 30 May 2023, 12],
# [Mon, 29 May 2023, 12],
# [Sun, 28 May 2023, 12],
# [Sat, 27 May 2023, 12],
# [Fri, 26 May 2023, 12],
# [Thu, 25 May 2023, 12],
# [Wed, 24 May 2023, 12],
# [Tue, 23 May 2023, 12],
# [Mon, 22 May 2023, 12],
# [Sun, 21 May 2023, 12],
# [Sat, 20 May 2023, 12],
# [Fri, 19 May 2023, 12],
# [Thu, 18 May 2023, 12],
# [Wed, 17 May 2023, 12],
# [Tue, 16 May 2023, 12],
# [Mon, 15 May 2023, 12],
# [Sun, 14 May 2023, 12],
# [Sat, 13 May 2023, 12],
# [Fri, 12 May 2023, 12],
# [Thu, 11 May 2023, 12],
# [Wed, 10 May 2023, 12],
# [Tue, 09 May 2023, 12],
# [Mon, 08 May 2023, 12],
# [Sun, 07 May 2023, 12],
# [Sat, 06 May 2023, 12],
# [Fri, 05 May 2023, 12],
# [Thu, 04 May 2023, 12],
# [Wed, 03 May 2023, 11],
# [Tue, 02 May 2023, 12],
# [Mon, 01 May 2023, 12],
# [Sun, 30 Apr 2023, 12],
# [Sat, 29 Apr 2023, 12],
# [Fri, 28 Apr 2023, 12],
# [Thu, 27 Apr 2023, 12],
# [Wed, 26 Apr 2023, 12],
# [Tue, 25 Apr 2023, 12],
# [Mon, 24 Apr 2023, 12],
# [Sun, 23 Apr 2023, 12],
# [Sat, 22 Apr 2023, 12],
# [Fri, 21 Apr 2023, 12],
# [Thu, 20 Apr 2023, 12],
# [Wed, 19 Apr 2023, 12],
# [Tue, 18 Apr 2023, 12],
# [Mon, 17 Apr 2023, 12],
# [Sun, 16 Apr 2023, 12],
# [Sat, 15 Apr 2023, 12],
# [Fri, 14 Apr 2023, 12],
# [Thu, 13 Apr 2023, 12],
# [Wed, 12 Apr 2023, 12],
# [Tue, 11 Apr 2023, 12],
# [Mon, 10 Apr 2023, 12],
# [Sun, 09 Apr 2023, 12],
# [Sat, 08 Apr 2023, 12],
# [Fri, 07 Apr 2023, 12],
# [Thu, 06 Apr 2023, 12],
# [Wed, 05 Apr 2023, 12],
# [Tue, 04 Apr 2023, 12],
# [Mon, 03 Apr 2023, 12],
# [Sun, 02 Apr 2023, 12],
# [Sat, 01 Apr 2023, 12],
# [Fri, 31 Mar 2023, 12],
# [Thu, 30 Mar 2023, 12],
# [Wed, 29 Mar 2023, 12],
# [Tue, 28 Mar 2023, 12],
# [Mon, 27 Mar 2023, 12],
# [Sun, 26 Mar 2023, 12],
# [Sat, 25 Mar 2023, 12],
# [Fri, 24 Mar 2023, 12],
# [Thu, 23 Mar 2023, 12],
# [Wed, 22 Mar 2023, 12],
# [Tue, 21 Mar 2023, 12],
# [Mon, 20 Mar 2023, 12],
# [Sun, 19 Mar 2023, 12],
# [Sat, 18 Mar 2023, 12],
# [Fri, 17 Mar 2023, 12],
# [Thu, 16 Mar 2023, 12],
# [Wed, 15 Mar 2023, 12],
# [Tue, 14 Mar 2023, 12],
# [Mon, 13 Mar 2023, 12],
# [Sun, 12 Mar 2023, 12],
# [Sat, 11 Mar 2023, 12],
# [Fri, 10 Mar 2023, 12],
# [Thu, 09 Mar 2023, 12],
# [Wed, 08 Mar 2023, 12],
# [Tue, 07 Mar 2023, 12],
# [Mon, 06 Mar 2023, 12],
# [Sun, 05 Mar 2023, 12],
# [Sat, 04 Mar 2023, 12],
# [Fri, 03 Mar 2023, 12],
# [Thu, 02 Mar 2023, 12],
# [Wed, 01 Mar 2023, 12],
# [Tue, 28 Feb 2023, 12],
# [Mon, 27 Feb 2023, 12],
# [Sun, 26 Feb 2023, 12],
# [Sat, 25 Feb 2023, 12],
# [Fri, 24 Feb 2023, 12],
# [Thu, 23 Feb 2023, 12],
# [Wed, 22 Feb 2023, 12],
# [Tue, 21 Feb 2023, 12],
# [Mon, 20 Feb 2023, 12],
# [Sun, 19 Feb 2023, 12],
# [Sat, 18 Feb 2023, 12],
# [Fri, 17 Feb 2023, 12],
# [Thu, 16 Feb 2023, 12],
# [Wed, 15 Feb 2023, 12],
# [Tue, 14 Feb 2023, 12],
# [Mon, 13 Feb 2023, 12],
# [Sun, 12 Feb 2023, 12],
# [Sat, 11 Feb 2023, 12],
# [Fri, 10 Feb 2023, 12],
# [Thu, 09 Feb 2023, 12],
# [Wed, 08 Feb 2023, 12],
# [Tue, 07 Feb 2023, 12],
# [Mon, 06 Feb 2023, 12],
# [Sun, 05 Feb 2023, 12],
# [Sat, 04 Feb 2023, 12],
# [Fri, 03 Feb 2023, 12],
# [Thu, 02 Feb 2023, 12],
# [Wed, 01 Feb 2023, 12],
# [Tue, 31 Jan 2023, 12],
# [Mon, 30 Jan 2023, 12],
# [Sun, 29 Jan 2023, 12],
# [Sat, 28 Jan 2023, 12],
# [Fri, 27 Jan 2023, 12],
# [Thu, 26 Jan 2023, 12],
# [Wed, 25 Jan 2023, 12],
# [Tue, 24 Jan 2023, 12],
# [Mon, 23 Jan 2023, 12],
# [Sun, 22 Jan 2023, 12],
# [Sat, 21 Jan 2023, 12],
# [Fri, 20 Jan 2023, 12],
# [Thu, 19 Jan 2023, 12],
# [Wed, 18 Jan 2023, 12],
# [Tue, 17 Jan 2023, 12],
# [Mon, 16 Jan 2023, 12],
# [Sun, 15 Jan 2023, 12],
# [Sat, 14 Jan 2023, 12],
# [Fri, 13 Jan 2023, 12],
# [Thu, 12 Jan 2023, 12],
# [Wed, 11 Jan 2023, 12],
# [Tue, 10 Jan 2023, 12],
# [Mon, 09 Jan 2023, 12],
# [Sun, 08 Jan 2023, 12],
# [Sat, 07 Jan 2023, 12],
# [Fri, 06 Jan 2023, 12],
# [Thu, 05 Jan 2023, 12],
# [Wed, 04 Jan 2023, 12],
# [Tue, 03 Jan 2023, 12],
# [Mon, 02 Jan 2023, 12],
# [Sun, 01 Jan 2023, 12],
# [Sat, 31 Dec 2022, 12],
# [Fri, 30 Dec 2022, 12],
# [Thu, 29 Dec 2022, 12],
# [Wed, 28 Dec 2022, 12],
# [Tue, 27 Dec 2022, 12],
# [Mon, 26 Dec 2022, 12],
# [Sun, 25 Dec 2022, 12],
# [Sat, 24 Dec 2022, 12],
# [Fri, 23 Dec 2022, 12],
# [Thu, 22 Dec 2022, 12],
# [Wed, 21 Dec 2022, 12],
# [Tue, 20 Dec 2022, 12],
# [Mon, 19 Dec 2022, 12],
# [Sun, 18 Dec 2022, 12],
# [Sat, 17 Dec 2022, 12],
# [Fri, 16 Dec 2022, 12],
# [Thu, 15 Dec 2022, 12],
# [Wed, 14 Dec 2022, 12],
# [Tue, 13 Dec 2022, 12],
# [Mon, 12 Dec 2022, 12],
# [Sun, 11 Dec 2022, 12],
# [Sat, 10 Dec 2022, 12],
# [Fri, 09 Dec 2022, 12],
# [Thu, 08 Dec 2022, 12],
# [Wed, 07 Dec 2022, 12],
# [Tue, 06 Dec 2022, 12],
# [Mon, 05 Dec 2022, 12],
# [Sun, 04 Dec 2022, 12],
# [Sat, 03 Dec 2022, 12],
# [Fri, 02 Dec 2022, 12],
# [Thu, 01 Dec 2022, 12],
# [Wed, 30 Nov 2022, 12],
# [Tue, 29 Nov 2022, 12],
# [Mon, 28 Nov 2022, 12],
# [Sun, 27 Nov 2022, 12],
# [Sat, 26 Nov 2022, 12],
# [Fri, 25 Nov 2022, 12],
# [Thu, 24 Nov 2022, 12],
# [Wed, 23 Nov 2022, 12],
# [Tue, 22 Nov 2022, 12],
# [Mon, 21 Nov 2022, 12],
# [Sun, 20 Nov 2022, 12],
# [Sat, 19 Nov 2022, 12],
# [Fri, 18 Nov 2022, 12],
# [Thu, 17 Nov 2022, 12],
# [Wed, 16 Nov 2022, 12],
# [Tue, 15 Nov 2022, 12],
# [Mon, 14 Nov 2022, 12],
# [Sun, 13 Nov 2022, 12],
# [Sat, 12 Nov 2022, 12],
# [Fri, 11 Nov 2022, 12],
# [Thu, 10 Nov 2022, 12],
# [Wed, 09 Nov 2022, 12],
# [Tue, 08 Nov 2022, 12],
# [Mon, 07 Nov 2022, 12],
# [Sun, 06 Nov 2022, 12],
# [Sat, 05 Nov 2022, 12],
# [Fri, 04 Nov 2022, 12],
# [Thu, 03 Nov 2022, 12],
# [Wed, 02 Nov 2022, 12],
# [Tue, 01 Nov 2022, 12],
# [Mon, 31 Oct 2022, 8],
# [Sun, 30 Oct 2022, 12],
# [Sat, 29 Oct 2022, 12],
# [Fri, 28 Oct 2022, 12],
# [Thu, 27 Oct 2022, 12],
# [Wed, 26 Oct 2022, 11],
# [Tue, 25 Oct 2022, 12],
# [Mon, 24 Oct 2022, 12],
# [Sun, 23 Oct 2022, 12],
# [Sat, 22 Oct 2022, 12],
# [Fri, 21 Oct 2022, 12],
# [Thu, 20 Oct 2022, 12],
# [Wed, 19 Oct 2022, 10],
# [Tue, 18 Oct 2022, 11],
# [Mon, 17 Oct 2022, 12],
# [Sun, 16 Oct 2022, 12],
# [Sat, 15 Oct 2022, 12],
# [Fri, 14 Oct 2022, 12],
# [Thu, 13 Oct 2022, 12],
# [Wed, 12 Oct 2022, 12],
# [Tue, 11 Oct 2022, 12],
# [Mon, 10 Oct 2022, 6],
# [Sun, 09 Oct 2022, 0],
# [Sat, 08 Oct 2022, 0],
# [Fri, 07 Oct 2022, 6],
# [Thu, 06 Oct 2022, 12],
# [Wed, 05 Oct 2022, 12],
# [Tue, 04 Oct 2022, 6],
# [Mon, 03 Oct 2022, 6],
# [Sun, 02 Oct 2022, 12],
# [Sat, 01 Oct 2022, 12],
# [Fri, 30 Sep 2022, 12],
# [Thu, 29 Sep 2022, 12],
# [Wed, 28 Sep 2022, 12],
# [Tue, 27 Sep 2022, 12],
# [Mon, 26 Sep 2022, 12],
# [Sun, 25 Sep 2022, 12],
# [Sat, 24 Sep 2022, 12],
# [Fri, 23 Sep 2022, 12],
# [Thu, 22 Sep 2022, 12],
# [Wed, 21 Sep 2022, 12],
# [Tue, 20 Sep 2022, 12],
# [Mon, 19 Sep 2022, 12],
# [Sun, 18 Sep 2022, 12],
# [Sat, 17 Sep 2022, 12],
# [Fri, 16 Sep 2022, 12],
# [Thu, 15 Sep 2022, 12],
# [Wed, 14 Sep 2022, 12],
# [Tue, 13 Sep 2022, 12],
# [Mon, 12 Sep 2022, 12],
# [Sun, 11 Sep 2022, 12],
# [Sat, 10 Sep 2022, 12],
# [Fri, 09 Sep 2022, 12],
# [Thu, 08 Sep 2022, 12],
# [Wed, 07 Sep 2022, 12],
# [Tue, 06 Sep 2022, 11],
# [Mon, 05 Sep 2022, 12],
# [Sun, 04 Sep 2022, 12],
# [Sat, 03 Sep 2022, 12],
# [Fri, 02 Sep 2022, 12],
# [Thu, 01 Sep 2022, 12],
# [Wed, 31 Aug 2022, 4],
# [Tue, 30 Aug 2022, 0],
# [Mon, 29 Aug 2022, 0],
# [Sun, 28 Aug 2022, 0],
# [Sat, 27 Aug 2022, 0],
# [Fri, 26 Aug 2022, 0],
# [Thu, 25 Aug 2022, 0],
# [Wed, 24 Aug 2022, 0],
# [Tue, 23 Aug 2022, 0],
# [Mon, 22 Aug 2022, 0],
# [Sun, 21 Aug 2022, 0],
# [Sat, 20 Aug 2022, 0],
# [Fri, 19 Aug 2022, 0],
# [Thu, 18 Aug 2022, 0],
# [Wed, 17 Aug 2022, 0],
# [Tue, 16 Aug 2022, 0],
# [Mon, 15 Aug 2022, 8],
# [Sun, 14 Aug 2022, 12],
# [Sat, 13 Aug 2022, 12],
# [Fri, 12 Aug 2022, 12],
# [Thu, 11 Aug 2022, 12],
# [Wed, 10 Aug 2022, 12],
# [Tue, 09 Aug 2022, 12],
# [Mon, 08 Aug 2022, 12],
# [Sun, 07 Aug 2022, 12],
# [Sat, 06 Aug 2022, 12],
# [Fri, 05 Aug 2022, 12],
# [Thu, 04 Aug 2022, 12],
# [Wed, 03 Aug 2022, 12],
# [Tue, 02 Aug 2022, 12],
# [Mon, 01 Aug 2022, 12],
# [Sun, 31 Jul 2022, 12],
# [Sat, 30 Jul 2022, 12],
# [Fri, 29 Jul 2022, 12],
# [Thu, 28 Jul 2022, 12],
# [Wed, 27 Jul 2022, 12],
# [Tue, 26 Jul 2022, 13],
# [Mon, 25 Jul 2022, 7],
# [Sun, 24 Jul 2022, 0],
# [Sat, 23 Jul 2022, 0],
# [Fri, 22 Jul 2022, 6],
# [Thu, 21 Jul 2022, 12],
# [Wed, 20 Jul 2022, 12],
# [Tue, 19 Jul 2022, 12],
# [Mon, 18 Jul 2022, 12],
# [Sun, 17 Jul 2022, 12],
# [Sat, 16 Jul 2022, 12],
# [Fri, 15 Jul 2022, 12],
# [Thu, 14 Jul 2022, 3],
# [Wed, 13 Jul 2022, 5],
# [Tue, 12 Jul 2022, 12],
# [Mon, 11 Jul 2022, 12],
# [Sun, 10 Jul 2022, 12],
# [Sat, 09 Jul 2022, 12],
# [Fri, 08 Jul 2022, 12],
# [Thu, 07 Jul 2022, 12],
# [Wed, 06 Jul 2022, 12],
# [Tue, 05 Jul 2022, 12],
# [Mon, 04 Jul 2022, 12],
# [Sun, 03 Jul 2022, 12],
# [Sat, 02 Jul 2022, 12],
# [Fri, 01 Jul 2022, 12],
# [Thu, 30 Jun 2022, 12],
# [Wed, 29 Jun 2022, 12],
# [Tue, 28 Jun 2022, 12],
# [Mon, 27 Jun 2022, 12],
# [Sun, 26 Jun 2022, 12],
# [Sat, 25 Jun 2022, 12],
# [Fri, 24 Jun 2022, 12],
# [Thu, 23 Jun 2022, 12],
# [Wed, 22 Jun 2022, 12],
# [Tue, 21 Jun 2022, 12],
# [Mon, 20 Jun 2022, 12],
# [Sun, 19 Jun 2022, 12],
# [Sat, 18 Jun 2022, 12],
# [Fri, 17 Jun 2022, 12],
# [Thu, 16 Jun 2022, 12],
# [Wed, 15 Jun 2022, 12],
# [Tue, 14 Jun 2022, 12],
# [Mon, 13 Jun 2022, 12],
# [Sun, 12 Jun 2022, 12],
# [Sat, 11 Jun 2022, 12],
# [Fri, 10 Jun 2022, 12],
# [Thu, 09 Jun 2022, 12],
# [Wed, 08 Jun 2022, 12],
# [Tue, 07 Jun 2022, 12],
# [Mon, 06 Jun 2022, 12],
# [Sun, 05 Jun 2022, 12],
# [Sat, 04 Jun 2022, 12],
# [Fri, 03 Jun 2022, 12],
# [Thu, 02 Jun 2022, 12],
# [Wed, 01 Jun 2022, 12],
# [Tue, 31 May 2022, 12],
# [Mon, 30 May 2022, 12],
# [Sun, 29 May 2022, 12],
# [Sat, 28 May 2022, 12],
# [Fri, 27 May 2022, 12],
# [Thu, 26 May 2022, 12],
# [Wed, 25 May 2022, 12],
# [Tue, 24 May 2022, 12],
# [Mon, 23 May 2022, 12],
# [Sun, 22 May 2022, 12],
# [Sat, 21 May 2022, 12],
# [Fri, 20 May 2022, 12],
# [Thu, 19 May 2022, 12],
# [Wed, 18 May 2022, 12],
# [Tue, 17 May 2022, 12],
# [Mon, 16 May 2022, 12],
# [Sun, 15 May 2022, 12],
# [Sat, 14 May 2022, 12],
# [Fri, 13 May 2022, 12],
# [Thu, 12 May 2022, 12],
# [Wed, 11 May 2022, 12],
# [Tue, 10 May 2022, 12],
# [Mon, 09 May 2022, 12],
# [Sun, 08 May 2022, 12],
# [Sat, 07 May 2022, 12],
# [Fri, 06 May 2022, 4],
# [Thu, 05 May 2022, 0],
# [Wed, 04 May 2022, 0],
# [Tue, 03 May 2022, 0],
# [Mon, 02 May 2022, 0],
# [Sun, 01 May 2022, 0],
# [Sat, 30 Apr 2022, 0],
# [Fri, 29 Apr 2022, 0],
# [Thu, 28 Apr 2022, 0],
# [Wed, 27 Apr 2022, 0],
# [Tue, 26 Apr 2022, 0],
# [Mon, 25 Apr 2022, 0],
# [Sun, 24 Apr 2022, 0]]
[*(1.months.ago.to_date..DateTime.now)].map do |date|
[date, Trainee.imported_from_hesa.where(record_source: "hesa_collection", created_at: date.beginning_of_day..date.end_of_day).count]
end.reverse
# [[Tue, 24 Oct 2023, 76], #(this one was triggered manually)
# [Mon, 23 Oct 2023, 35],
# [Sun, 22 Oct 2023, 0],
# [Sat, 21 Oct 2023, 0],
# [Fri, 20 Oct 2023, 13],
# [Thu, 19 Oct 2023, 670],
# [Wed, 18 Oct 2023, 597],
# [Tue, 17 Oct 2023, 3494],
# [Mon, 16 Oct 2023, 2512],
# [Sun, 15 Oct 2023, 0],
# [Sat, 14 Oct 2023, 0],
# [Fri, 13 Oct 2023, 708],
# [Thu, 12 Oct 2023, 587],
# [Wed, 11 Oct 2023, 0],
# [Tue, 10 Oct 2023, 0]]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment