From a6edf1acd187b26ba72213e8016cf47938296ca0 Mon Sep 17 00:00:00 2001
From: Chad Redman <chad_redman@unc.edu>
Date: Fri, 11 Jun 2021 00:29:50 -0400
Subject: [PATCH] Update 201.1 student years to 2022-2025

---
 .../container_files/seed-data/bootstrap.gsh    |  2 +-
 .../container_files/seed-data/sisData.sql      | 18 ++++++++++++++++--
 .../container_files/seed-data/bootstrap.gsh    |  8 ++++----
 3 files changed, 21 insertions(+), 7 deletions(-)

diff --git a/ex201/ex201.1.1/container_files/seed-data/bootstrap.gsh b/ex201/ex201.1.1/container_files/seed-data/bootstrap.gsh
index 67ee0c2..4390c2a 100644
--- a/ex201/ex201.1.1/container_files/seed-data/bootstrap.gsh
+++ b/ex201/ex201.1.1/container_files/seed-data/bootstrap.gsh
@@ -22,7 +22,7 @@ setGroupAttr("etc:studentTermLoader", "grouperLoaderQuery", "select distinct id
 // Stub out class groups. These will be filled out by the studentTermLoader
 addStem("ref", "student", "student");
 def classList = [:]
-(2019..2024).each { term ->
+(2020..2025).each { term ->
     classList[term] = addGroup("ref:student", "class${term}", "class${term}")
 }
 
diff --git a/ex201/ex201.1.1/container_files/seed-data/sisData.sql b/ex201/ex201.1.1/container_files/seed-data/sisData.sql
index 390a712..713b590 100644
--- a/ex201/ex201.1.1/container_files/seed-data/sisData.sql
+++ b/ex201/ex201.1.1/container_files/seed-data/sisData.sql
@@ -3740,9 +3740,23 @@ INSERT INTO HR_PEOPLE_ROLES(id, role) VALUES ('80000999','community');
 INSERT INTO HR_PEOPLE(id, surname, givenName) VALUES ('80001000','Davis','Bill');
 INSERT INTO HR_PEOPLE_ROLES(id, role) VALUES ('80001000','community');
 
-/* make the original term ranges more relevant to the current year -- October 2020 should have 2019-2024 */
+/*
+COUNT(*) | TERM
+---------+-----
+      59 | 2018
+      53 | 2019
+      55 | 2020
+      55 | 2021
+      55 | 2022
+      61 | 2023
+*/
+
+/* 
+ * Make the original term ranges more relevant to the current year -- June 2021 should have 2020-2025 (2021=recent grads, 2025=incoming 1st year).
+ * Note, also edit the ref group range to 2020..2025 in bootstrap.gsh
+ */
 
 ALTER TABLE SIS_STUDENT_TERMS DROP PRIMARY KEY;
-UPDATE SIS_STUDENT_TERMS SET term = CONVERT(term, UNSIGNED INTEGER) + 1;
+UPDATE SIS_STUDENT_TERMS SET term = CONVERT(term, UNSIGNED INTEGER) + 2;
 ALTER TABLE SIS_STUDENT_TERMS ADD PRIMARY KEY (id, term);
 
diff --git a/ex201/ex201.1.end/container_files/seed-data/bootstrap.gsh b/ex201/ex201.1.end/container_files/seed-data/bootstrap.gsh
index 08cb7be..66a9921 100644
--- a/ex201/ex201.1.end/container_files/seed-data/bootstrap.gsh
+++ b/ex201/ex201.1.end/container_files/seed-data/bootstrap.gsh
@@ -23,17 +23,17 @@ attributeAssign.getAttributeValueDelegate().assignValue("etc:objectTypes:grouper
 // addGroup("ref:student", "class2022", "class2022");
 // addGroup("ref:student", "class2023", "class2023");
 
-(2021..2024).each { term ->
+(2022..2025).each { term ->
     addMember("ref:student:students","ref:student:class${term}");
 }
 
 //Set expiration out Dec 31, 2020 days
 java.util.Calendar cal = Calendar.getInstance();
-cal.set(2021, Calendar.MARCH, 31, 17, 0, 0)
+cal.set(2021, Calendar.DECEMBER, 31, 17, 0, 0)
 
-addMember("ref:student:students","ref:student:class2020");
+addMember("ref:student:students","ref:student:class2021");
 group = GroupFinder.findByName(gs, "ref:student:students", true);
-subject = GroupFinder.findByName(gs, "ref:student:class2020", true).toSubject();
+subject = GroupFinder.findByName(gs, "ref:student:class2021", true).toSubject();
 group.addOrEditMember(subject, true, true, null, cal.getTime(), false);
 
 // ex 201.1.2