updates sp25

This commit is contained in:
Peter Howell 2025-01-16 11:20:03 -08:00
parent 74de8743ca
commit 2c42225f8b
3 changed files with 54 additions and 12 deletions

View File

@ -1031,7 +1031,7 @@ def enroll_id_list_to_shell(id_list, shell_id, v=0):
# multiple semesters
def enroll_stem_students_live():
semesters = [184,]
semesters = [286,287]
for S in semesters:
enroll_stem_students_live_semester(S)
@ -1300,7 +1300,7 @@ def enroll_orientation_students():
DO_IT = 1
import localcache2
ori_shell_id = "19094" # 2024 # "" # 2023 orientation shell 15924 # 2022: "9768"
ori_shell_id = "20862" # 2025 "19094" # 2024 # "" # 2023 orientation shell 15924 # 2022: "9768"
print("Getting users in orientation shell")
#users_in_ori_shell = set( \
@ -1312,7 +1312,7 @@ def enroll_orientation_students():
# users_to_enroll = users_new_this_semester(the_semester) ### ##### USES LOCAL DB
# double semester (SU + FA)
users_to_enroll = users_new_this_2x_semester("202450", "202470") ##### USES LOCAL DB
users_to_enroll = users_new_this_2x_semester("202510", "202530") ##### USES LOCAL DB
#print("ALL ORIENTATION STUDENTS %s" % str(users_to_enroll))
#print("\n\nALREADY IN ORI SHELL %s" % str(users_in_ori_shell))

View File

@ -181,11 +181,11 @@ def path_style_prog():
oo.flush()
def term_txt_to_code(t):
term_codes = {'Spring':'30','Summer':'50','Fall':'70'}
parts = t.split(" ")
if len(parts)>1:
yr = parts[1]
sem = term_codes[parts[0]]
term_codes = {'Winter Intersession':'10','Spring':'30','Summer':'50','Fall':'70'}
m = re.search(r'(^.*)\s(\d\d\d+\d+)$', t)
if m:
yr = m.group(2)
sem = term_codes[m.group(1)]
return yr+sem
return ''
@ -333,10 +333,10 @@ def path_style_2_html():
v = verbose
prog_title_subs = []
with codecs.open('cache/program_published_names.csv', 'r','utf-8') as file:
reader = csv.reader(file)
for row in reader:
prog_title_subs.append(row)
#with codecs.open('cache/program_published_names.csv', 'r','utf-8') as file:
# reader = csv.reader(file)
# for row in reader:
# prog_title_subs.append(row)
oo = codecs.open("cache/programs/allprogrampaths.txt","r","utf-8").readlines()

View File

@ -260,12 +260,54 @@ def find_unnamed_people():
for Q in queries:
print(Q)
import pandas as pd
# Function to generate SQL INSERT statements
def generate_insert_statements(table_name='conf_sessions'):
# Read the CSV into a pandas DataFrame
df = pd.read_csv('cache/flexsessions.csv')
# Drop the columns 'date' and 'Start' (case-sensitive)
df = df.drop(columns=['date', 'Start'], errors='ignore')
# Drop any columns that are unnamed (such as 'Unnamed: 8')
df = df.loc[:, ~df.columns.str.contains('^Unnamed')]
insert_statements = []
# Iterate over each row in the DataFrame
for index, row in df.iterrows():
columns = ", ".join(df.columns) # Get column names from the DataFrame
values = ", ".join(["'{0}'".format(str(value).replace("'", "''")) for value in row.values]) # Escape single quotes in values
# Construct the SQL INSERT statement
#insert_statement = f"INSERT INTO {table_name} ({columns}) VALUES ({values});"
#insert_statements.append(insert_statement)
set_clause = ", ".join(["`{}`='{}'".format(col, str(value).replace("'", "''")) for col, value in row.items()])
# Construct the SQL INSERT statement using SET
insert_statement = f"INSERT INTO {table_name} SET {set_clause};"
insert_statements.append(insert_statement)
for S in insert_statements:
print(S)
return insert_statements
if __name__ == "__main__":
print ("")
options = { 1: ['(old) sync conf_user and iLearn employee tables', user_db_sync2] ,
2: ['generate sql to fix conf_user dups', correct_dup_user_rows] ,
3: ['add names to new accounts', find_unnamed_people],
4: ['search for user', search_user],
5: ['generate insert statements', generate_insert_statements ]
}