diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb
index 5e96e03a..159763ea 100644
--- a/app/controllers/courses_controller.rb
+++ b/app/controllers/courses_controller.rb
@@ -156,8 +156,8 @@ def handle_add_students
ActiveRecord::Base.transaction do
# Remove the leading 'S-' from student IDs if present
csv_obj.each do |row|
- student_id = row['ID number']
- row['ID number'] = student_id&.replace(student_id[2..]) if student_id&.start_with?('S-')
+ instid = row['ID number']
+ row['ID number'] = instid&.replace(instid[2..]) if instid&.start_with?('S-')
end
if @course.grouped
@@ -381,16 +381,16 @@ def create_db_entries_grouped(hash_map, parent_course, unregistered_students, re
new_user = User.find_by(email_address: group_member[:email_address], is_staff: false)
if new_user
- new_user.update!(student_id: group_member[:student_id])
+ new_user.update!(instid: group_member[:instid])
registered_students.push(group_member[:email_address]) if new_user.enrolments.where(course: parent_course).empty?
else
new_user = User.create!(
email_address: group_member[:email_address],
- username: group_member[:name],
+ name: group_member[:name],
password: SecureRandom.base64(24),
has_registered: false,
- student_id: group_member[:student_id],
+ instid: group_member[:instid],
is_staff: false
)
@@ -463,16 +463,16 @@ def create_db_entries_solo(student_set, parent_course, unregistered_students, re
new_user = User.find_by(email_address: student[:email_address], is_staff: false)
if new_user
- new_user.update!(student_id: student[:student_id])
+ new_user.update!(instid: student[:instid])
registered_students.push(student[:email_address]) if new_user.enrolments.where(course: parent_course).empty?
else
new_user = User.create!(
email_address: student[:email_address],
- username: student[:name],
+ name: student[:name],
password: SecureRandom.base64(24),
has_registered: false,
- student_id: student[:student_id],
+ instid: student[:instid],
is_staff: false
)
@@ -512,7 +512,7 @@ def create_lecturer_enrolments(lecturer_emails, parent_course, unregistered_lect
password: SecureRandom.base64(24),
has_registered: false,
is_staff: true,
- username: "Lecturer-#{SecureRandom.hex(2)}"
+ name: "Lecturer-#{SecureRandom.hex(2)}"
)
new_otp_instance = Otp.create!(
@@ -562,7 +562,7 @@ def generate_csv_export
end
def build_csv_headers(template_fields)
- headers = %w[Student_Name Student_ID Email_Address]
+ headers = %w[Student_Name instid Email_Address]
headers << 'Student Group' if @course.grouped?
headers += %w[Supervisor_Name Supervisor_Email_Address Project_Title Project_Status]
@@ -589,11 +589,11 @@ def build_group_rows(group, template_fields)
group.project_group_members.each do |member|
user = member.user
row = [
- user.username || '',
- user.student_id || '',
+ user.name || '',
+ user.instid || '',
user.email_address || '',
group.group_name || '',
- supervisor&.username || '',
+ supervisor&.name || '',
supervisor&.email_address || '',
project&.current_title || '',
project_status.humanize
@@ -612,10 +612,10 @@ def build_student_rows(student, template_fields)
field_values = get_project_details_values(current_instance, template_fields)
row = [
- student.username || '',
- student.student_id || '',
+ student.name || '',
+ student.instid || '',
student.email_address || '',
- supervisor&.username || '',
+ supervisor&.name || '',
supervisor&.email_address || '',
project&.current_title || '',
project_status.humanize
@@ -744,7 +744,7 @@ def search_groups(group_list, query)
group_name_match = group.group_name.downcase.include?(downcased_query)
member_match = group.project_group_members.any? do |member|
- member.user.username.downcase.include?(downcased_query)
+ member.user.name.downcase.include?(downcased_query)
end
title_match = project&.current_title&.downcase&.include?(downcased_query) || false
@@ -758,8 +758,8 @@ def search_students(student_list, query)
student_list.select do |student|
project = participant_project(student, 'User')
- name_match = student.username.downcase.include?(downcased_query)
- id_match = student.student_id&.downcase&.include?(downcased_query) || false
+ name_match = student.name.downcase.include?(downcased_query)
+ id_match = student.instid&.downcase&.include?(downcased_query) || false
title_match = project&.current_title&.downcase&.include?(downcased_query) || false
name_match || id_match || title_match
@@ -782,7 +782,7 @@ def sort_value_for_group(group)
when 'project_title'
project&.current_title&.downcase || ''
when 'supervisor'
- project&.supervisor&.username&.downcase || ''
+ project&.supervisor&.name&.downcase || ''
else
group.group_name.downcase
end
@@ -796,9 +796,9 @@ def sort_value_for_student(student)
when 'project_title'
project&.current_title&.downcase || ''
when 'supervisor'
- project&.supervisor&.username&.downcase || ''
+ project&.supervisor&.name&.downcase || ''
else
- student.username.downcase
+ student.name.downcase
end
end
diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb
index a433f1ce..15aad414 100644
--- a/app/controllers/projects_controller.rb
+++ b/app/controllers/projects_controller.rb
@@ -60,7 +60,7 @@ def change_status
GeneralMailer.with(
course: @course,
project: @project,
- supervisor_username: Current.user.username
+ supervisor_name: Current.user.name
).Project_Status_Updated.deliver_later
redirect_to course_project_path(@course, @project), notice: "Status updated to #{new_status.humanize}."
@@ -197,8 +197,8 @@ def create
GeneralMailer.with(
email_address: @project.supervisor.email_address,
- supervisor_username: @project.supervisor.username,
- owner_name: @course.grouped? ? @project.owner.group_name : @project.owner.username,
+ supervisor_name: @project.supervisor.name,
+ owner_name: @course.grouped? ? @project.owner.group_name : @project.owner.name,
course: @course,
project: @project
).New_Student_Submission.deliver_later
@@ -297,8 +297,8 @@ def update
if previous_supervisor_id != @project.supervisor.id || new_instance_created
GeneralMailer.with(
- supervisor_username: @project.supervisor.username,
- owner_name: @course.grouped? ? @project.owner.group_name : @project.owner.username,
+ supervisor_name: @project.supervisor.name,
+ owner_name: @course.grouped? ? @project.owner.group_name : @project.owner.name,
course: @course,
project: @project
).New_Student_Submission.deliver_later
diff --git a/app/controllers/topics_controller.rb b/app/controllers/topics_controller.rb
index fa30d324..7eac4dc2 100644
--- a/app/controllers/topics_controller.rb
+++ b/app/controllers/topics_controller.rb
@@ -188,11 +188,11 @@ def change_status
end
GeneralMailer.with(
- username: @topic.owner.username,
+ name: @topic.owner.name,
email_address: @topic.owner.email_address,
course: @course,
topic: @topic,
- supervisor_username: Current.user.username
+ supervisor_name: Current.user.name
).Topic_Status_Updated.deliver_later
redirect_to course_topic_path(@course, @topic), notice: 'Status updated.'
diff --git a/app/controllers/user_controller.rb b/app/controllers/user_controller.rb
index a022dc35..afac87bc 100644
--- a/app/controllers/user_controller.rb
+++ b/app/controllers/user_controller.rb
@@ -39,8 +39,8 @@ def edit
return
end
- if params[:user][:username].blank?
- redirect_back_or_to '/', alert: 'Username cannot be empty'
+ if params[:user][:name].blank?
+ redirect_back_or_to '/', alert: 'Name cannot be empty'
return
end
@@ -56,7 +56,7 @@ def edit
begin
Current.user.update!(
- username: params[:user][:username],
+ name: params[:user][:name],
web_link: params[:user][:web_link],
description: params[:user][:description]
)
@@ -71,7 +71,7 @@ def edit
end
def create
- response = params.permit(:password, :password_confirmation, :username, :token, :otp)
+ response = params.permit(:password, :password_confirmation, :name, :token, :otp)
return if response[:token].blank?
if response[:otp].blank?
@@ -108,7 +108,7 @@ def create
user = otp_instance.user
- if response[:username].blank? && user.is_staff
+ if response[:name].blank? && user.is_staff
redirect_back_or_to '/', alert: 'Name cannot be empty'
return
end
@@ -120,7 +120,7 @@ def create
else
redirect_back_or_to '/', alert: 'Something went wrong'
end
- elsif user.update(has_registered: true, password: response[:password], username: response[:username].strip)
+ elsif user.update(has_registered: true, password: response[:password], name: response[:name].strip)
redirect_to '/session/new', notice: 'Account successfully claimed'
else
redirect_back_or_to '/', alert: 'Something went wrong'
diff --git a/app/helpers/projects_helper.rb b/app/helpers/projects_helper.rb
index 72b1ac90..2cbf5f6c 100644
--- a/app/helpers/projects_helper.rb
+++ b/app/helpers/projects_helper.rb
@@ -7,9 +7,9 @@ def show_progress_tab?
@course.use_progress_updates && @current_instance.status == 'approved'
end
- def username(user_id)
+ def name(user_id)
return nil unless user_id.present?
- User.find_by(id: user_id)&.username
+ User.find_by(id: user_id)&.name
end
end
diff --git a/app/mailers/general_mailer.rb b/app/mailers/general_mailer.rb
index f7b46355..a9f1a4b6 100644
--- a/app/mailers/general_mailer.rb
+++ b/app/mailers/general_mailer.rb
@@ -10,14 +10,14 @@ def ProPro_Invite
def Project_Status_Updated
@course = params[:course]
@project = params[:project]
- @supervisor_username = params[:supervisor_username]
+ @supervisor_name = params[:supervisor_name]
if @course.grouped?
emails = @project.owner.project_group_members.joins(:user).pluck('user.email_address')
@recipient = @project.owner.group_name
mail(to: emails, Subject: 'Status Updated')
else
- @recipient = @project.owner.username
+ @recipient = @project.owner.name
mail(to: @project.owner.email_address, Subject: 'Status Updated')
end
end
@@ -25,14 +25,14 @@ def Project_Status_Updated
def Topic_Status_Updated
@course = params[:course]
@topic = params[:topic]
- @supervisor_username = params[:supervisor_username]
+ @supervisor_name = params[:supervisor_name]
- @recipient = @topic.owner.username
+ @recipient = @topic.owner.name
mail(to: @topic.owner.email_address, Subject: 'Status Updated')
end
def New_Student_Submission
- @supervisor_username = params[:supervisor_username]
+ @supervisor_name = params[:supervisor_name]
@owner_name = params[:owner_name]
@course = params[:course]
@project = params[:project]
diff --git a/app/models/course.rb b/app/models/course.rb
index 85fbb468..5cede4fa 100644
--- a/app/models/course.rb
+++ b/app/models/course.rb
@@ -70,7 +70,7 @@ def parse_csv_grouped(csv_obj)
ret[group] ||= Set[]
ret[group].add({
name: row['Last name'].strip,
- student_id: row['ID number'].strip,
+ instid: row['ID number'].strip,
email_address: row['Email address'].strip
})
end
@@ -87,7 +87,7 @@ def parse_csv_solo(csv_obj)
ret.add({
name: row['Last name'].strip,
- student_id: row['ID number'].strip,
+ instid: row['ID number'].strip,
email_address: row['Email address'].strip
})
end
diff --git a/app/models/user.rb b/app/models/user.rb
index 7931334b..0dac08a3 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -3,7 +3,7 @@ class User < ApplicationRecord
has_many :sessions, dependent: :destroy
normalizes :email_address, with: ->(e) { e.strip.downcase }
- normalizes :username, with: ->(n) { n.strip }
+ normalizes :name, with: ->(n) { n.strip }
has_many :enrolments, dependent: :destroy
has_many :courses, through: :enrolments
diff --git a/app/views/courses/_copy_course_overlay.html.erb b/app/views/courses/_copy_course_overlay.html.erb
index bef360b0..88b05b04 100644
--- a/app/views/courses/_copy_course_overlay.html.erb
+++ b/app/views/courses/_copy_course_overlay.html.erb
@@ -34,11 +34,11 @@
- <%= course_item.coordinators.first&.username&.first&.upcase || "?" %>
+ <%= course_item.coordinators.first&.name&.first&.upcase || "?" %>
Coordinator:
- <%= course_item.coordinators.first&.username || "None" %>
+ <%= course_item.coordinators.first&.name || "None" %>
diff --git a/app/views/courses/_course_card.html.erb b/app/views/courses/_course_card.html.erb
index cca591f3..07db4623 100644
--- a/app/views/courses/_course_card.html.erb
+++ b/app/views/courses/_course_card.html.erb
@@ -16,10 +16,10 @@
- <%= course.coordinators.first&.username&.first&.upcase || "?" %>
+ <%= course.coordinators.first&.name&.first&.upcase || "?" %>
- Coordinator: <%= course.coordinators.first&.username || "None" %>
+ Coordinator: <%= course.coordinators.first&.name || "None" %>
diff --git a/app/views/courses/_lecturers.html.erb b/app/views/courses/_lecturers.html.erb
index e9f5668e..07facb51 100644
--- a/app/views/courses/_lecturers.html.erb
+++ b/app/views/courses/_lecturers.html.erb
@@ -6,14 +6,14 @@
w-10 h-10 bg-[#d9d9d9] rounded-full shrink-0 flex justify-center items-center
text-[20px] text-gray-700 font-medium
">
- <%= lecturer.username.first.upcase %>
+ <%= lecturer.name.first.upcase %>
- <%= lecturer.username %>
+ <%= lecturer.name %>
<% capacity_info = @lecturer_capacity_info[lecturer.id] %>
diff --git a/app/views/courses/_participants.html.erb b/app/views/courses/_participants.html.erb
index 324eaa32..03c38d5f 100644
--- a/app/views/courses/_participants.html.erb
+++ b/app/views/courses/_participants.html.erb
@@ -86,7 +86,7 @@
- ><%= lecturer.username %>
+ ><%= lecturer.name %>
<% end %>
diff --git a/app/views/courses/_participants_table.html.erb b/app/views/courses/_participants_table.html.erb
index 7b6c704e..70e4ed50 100644
--- a/app/views/courses/_participants_table.html.erb
+++ b/app/views/courses/_participants_table.html.erb
@@ -64,7 +64,7 @@
<% else %>
- <% sort_column.call('student_id', 'Student ID', 'person_grey.svg', width: 'w-[14.28%]') %>
+ <% sort_column.call('instid', 'Student ID', 'person_grey.svg', width: 'w-[14.28%]') %>
<% end %>
<%# 3. Project Title %>
@@ -116,9 +116,9 @@
text-[10px] font-bold text-gray-600 align-middle mr-1
group-hover/member:bg-gray-300 transition-colors
">
- <%= member.user.username.first.upcase %>
+ <%= member.user.name.first.upcase %>
- <%= member.user.username || "-" %>
+ <%= member.user.name || "-" %>
<% end %>
<% unless member.user.has_registered %>
@@ -199,12 +199,12 @@
font-bold text-gray-600 shrink-0 group-hover/sup:bg-blue-100
group-hover/sup:text-gray-700 transition-colors
">
- <%= supervisor.username.first.upcase %>
+ <%= supervisor.name.first.upcase %>
- <%= supervisor.username %>
+ title="<%= supervisor.name %>">
+ <%= supervisor.name %>
<% end %>
<% else %>
@@ -247,9 +247,9 @@
inline-flex items-center justify-center w-6 h-6 rounded-full bg-gray-200
text-[10px] font-bold text-gray-600 align-middle mr-1
">
- <%= student.username.first.upcase %>
+ <%= student.name.first.upcase %>
- <%= student.username || "-" %>
+ <%= student.name || "-" %>
<% end %>
<% unless student.has_registered %>
@@ -277,7 +277,7 @@
<%# 2. Student ID %>
<%= link_to participant_profile_course_path(@course, student.id, 'student'), class: "hover:text-gray-700" do %>
- <%= student.student_id || "-" %>
+ <%= student.instid || "-" %>
<% end %>
@@ -335,12 +335,12 @@
font-bold text-gray-600 shrink-0 group-hover/sup:bg-blue-100
group-hover/sup:text-gray-700 transition-colors
">
- <%= supervisor.username.first.upcase %>
+ <%= supervisor.name.first.upcase %>
- <%= supervisor.username %>
+ title="<%= supervisor.name %>">
+ <%= supervisor.name %>
<% end %>
<% else %>
diff --git a/app/views/courses/_project_card_contents.html.erb b/app/views/courses/_project_card_contents.html.erb
index ec38058f..e5238eeb 100644
--- a/app/views/courses/_project_card_contents.html.erb
+++ b/app/views/courses/_project_card_contents.html.erb
@@ -16,8 +16,8 @@ description_text = found_text if found_text.present?
# --- Determine Owner Name ---
owner_name =
- if project.owner.respond_to?(:username)
- project.owner.username
+ if project.owner.respond_to?(:name)
+ project.owner.name
elsif project.owner.respond_to?(:group_name)
project.owner.group_name
else
diff --git a/app/views/courses/_topic_card_contents.html.erb b/app/views/courses/_topic_card_contents.html.erb
index c6dd828e..37885bf3 100644
--- a/app/views/courses/_topic_card_contents.html.erb
+++ b/app/views/courses/_topic_card_contents.html.erb
@@ -50,8 +50,8 @@ description_text =
# --- Determine Owner Name ---
owner_name =
- if topic.owner.respond_to?(:username)
- topic.owner.username
+ if topic.owner.respond_to?(:name)
+ topic.owner.name
elsif topic.owner.respond_to?(:group_name)
topic.owner.group_name
else
diff --git a/app/views/courses/profile.html.erb b/app/views/courses/profile.html.erb
index dd5a1ac5..2e6aef70 100644
--- a/app/views/courses/profile.html.erb
+++ b/app/views/courses/profile.html.erb
@@ -3,7 +3,7 @@
<% end %>
<% content_for :body_class, "bg-gray-50" %>
<% participant_name =
- @participant_type == "group" ? @group.group_name : @student.username %>
+ @participant_type == "group" ? @group.group_name : @student.name %>
<%# --- Breadcrumbs --- %>
<% breadcrumb :course, @course %>
@@ -14,7 +14,7 @@
<%= @group.group_name %>
- Group Profile | ProPro
<% else %>
- <%= @student.username %>
+ <%= @student.name %>
- Student Profile | ProPro
<% end %>
<% end %>
@@ -94,9 +94,9 @@
justify-center text-3xl font-bold shrink-0 uppercase shadow-sm
"
>
- <%= @student.username[0].upcase %>
+ <%= @student.name[0].upcase %>
- <%= @student.username %>
+ <%= @student.name %>
<% else %>
<%= @group.group_name %>
<% end %>
@@ -141,15 +141,15 @@
justify-center text-sm font-bold text-gray-700 shrink-0 shadow-sm
"
>
- <%= member.user.username.first.upcase %>
+ <%= member.user.name.first.upcase %>
-
<%= member.user.username %>
+
<%= member.user.name %>
- <% if member.user.student_id.present? %>
+ <% if member.user.instid.present? %>
STUDENT ID:
- <%= member.user.student_id %>
+ <%= member.user.instid %>
<% end %>
<%= member.user.email_address %>
@@ -166,13 +166,13 @@
<%# Name %>
Name
- <%= @student.username %>
+ <%= @student.name %>
<%# ID %>
Student ID
- <%= @student.student_id || "-" %>
+ <%= @student.instid || "-" %>
<%# Email %>
@@ -250,9 +250,9 @@
justify-center text-xs font-bold text-gray-700 shrink-0
"
>
- <%= @supervisor.username.first.upcase %>
+ <%= @supervisor.name.first.upcase %>
- <%= @supervisor.username %>
+ <%= @supervisor.name %>
<% end %>
diff --git a/app/views/general_mailer/New_Student_Submission.html.erb b/app/views/general_mailer/New_Student_Submission.html.erb
index 98d9a511..a63e7f37 100644
--- a/app/views/general_mailer/New_Student_Submission.html.erb
+++ b/app/views/general_mailer/New_Student_Submission.html.erb
@@ -30,7 +30,7 @@
- Hi, <%= @supervisor_username %>
+ Hi, <%= @supervisor_name %>
diff --git a/app/views/general_mailer/New_Student_Submission.text.erb b/app/views/general_mailer/New_Student_Submission.text.erb
index 59bd755f..2cfaca68 100644
--- a/app/views/general_mailer/New_Student_Submission.text.erb
+++ b/app/views/general_mailer/New_Student_Submission.text.erb
@@ -1,7 +1,7 @@
ProPro - You have received a proposal.
=======================================
-Hi, <%= @supervisor_username %>
+Hi, <%= @supervisor_name %>
<%= @course.course_name %>
<%= @project.project_instances.last.title %>
diff --git a/app/views/general_mailer/Project_Status_Updated.html.erb b/app/views/general_mailer/Project_Status_Updated.html.erb
index 129727e0..ab85bf7b 100644
--- a/app/views/general_mailer/Project_Status_Updated.html.erb
+++ b/app/views/general_mailer/Project_Status_Updated.html.erb
@@ -42,7 +42,7 @@
- Your proposal has received a response from <%= @supervisor_username %> .
+ Your proposal has received a response from <%= @supervisor_name %> .
To view it, visit this link:
diff --git a/app/views/general_mailer/Project_Status_Updated.text.erb b/app/views/general_mailer/Project_Status_Updated.text.erb
index 070a91c2..1e3ecfc6 100644
--- a/app/views/general_mailer/Project_Status_Updated.text.erb
+++ b/app/views/general_mailer/Project_Status_Updated.text.erb
@@ -6,7 +6,7 @@ Hi, <%= @recipient %>
<%= @course.course_name %>
<%= @project.project_instances.last.title %>
-Your proposal has received a response from <%= @supervisor_username %>.
+Your proposal has received a response from <%= @supervisor_name %>.
To view it, visit this link:
<%= course_project_url(@course, @project) %>
diff --git a/app/views/general_mailer/Topic_Status_Updated.html.erb b/app/views/general_mailer/Topic_Status_Updated.html.erb
index 89756e35..5011f1af 100644
--- a/app/views/general_mailer/Topic_Status_Updated.html.erb
+++ b/app/views/general_mailer/Topic_Status_Updated.html.erb
@@ -42,7 +42,7 @@
- Your proposal has received a response from <%= @supervisor_username %> .
+ Your proposal has received a response from <%= @supervisor_name %> .
To view it, visit this link:
diff --git a/app/views/general_mailer/Topic_Status_Updated.text.erb b/app/views/general_mailer/Topic_Status_Updated.text.erb
index 43ac892e..0f87a9e9 100644
--- a/app/views/general_mailer/Topic_Status_Updated.text.erb
+++ b/app/views/general_mailer/Topic_Status_Updated.text.erb
@@ -6,7 +6,7 @@ Hi, <%= @recipient %>
<%= @course.course_name %>
<%= @topic.topic_instances.last.title %>
-Your proposal has received a response from <%= @supervisor_username %>.
+Your proposal has received a response from <%= @supervisor_name %>.
To view it, visit this link:
<%= course_topic_url(@course, @topic) %>
diff --git a/app/views/homescreen/show.html.erb b/app/views/homescreen/show.html.erb
index 9847d7f3..2314f376 100644
--- a/app/views/homescreen/show.html.erb
+++ b/app/views/homescreen/show.html.erb
@@ -40,7 +40,7 @@
>
-
<%= Current.user.username %>'s Dashboard
+ <%= Current.user.name %>'s Dashboard
Your Courses
@@ -101,11 +101,11 @@
font-bold text-gray-500
"
>
- <%= course.coordinators.first&.username&.first&.upcase || "?" %>
+ <%= course.coordinators.first&.name&.first&.upcase || "?" %>
Coordinator:
- <%= course.coordinators.first&.username || "None" %>
+ <%= course.coordinators.first&.name || "None" %>
diff --git a/app/views/lecturers/index.html.erb b/app/views/lecturers/index.html.erb
index 8ada479a..516a5b56 100644
--- a/app/views/lecturers/index.html.erb
+++ b/app/views/lecturers/index.html.erb
@@ -5,7 +5,7 @@
<% @lecturers.each do |lecturer| %>
- Name: <%= link_to lecturer.username, course_lecturer_path(@course, lecturer) %>
+ Name: <%= link_to lecturer.name, course_lecturer_path(@course, lecturer) %>
<% end %>
diff --git a/app/views/lecturers/show.html.erb b/app/views/lecturers/show.html.erb
index 945b367a..ba4b500f 100644
--- a/app/views/lecturers/show.html.erb
+++ b/app/views/lecturers/show.html.erb
@@ -8,7 +8,7 @@
<% breadcrumb :lecturer, @course, @lecturer %>
<% content_for :title,
-"#{@lecturer.username.truncate(TITLE_NAME_LIMIT)} - View Supervisor | ProPro" %>
+"#{@lecturer.name.truncate(TITLE_NAME_LIMIT)} - View Supervisor | ProPro" %>
<%# --- Sidebar --- %>
<% content_for :sidebar do %>
@@ -99,7 +99,7 @@
text-3xl font-bold shrink-0 uppercase
"
>
- <%= @lecturer.username[0].upcase %>
+ <%= @lecturer.name[0].upcase %>
- <%= @lecturer.username %>
+ <%= @lecturer.name %>
diff --git a/app/views/projects/_project_comments.html.erb b/app/views/projects/_project_comments.html.erb
index fb567804..7c4e31b9 100644
--- a/app/views/projects/_project_comments.html.erb
+++ b/app/views/projects/_project_comments.html.erb
@@ -41,7 +41,7 @@
text-xs font-bold ring-4 ring-gray-50/30
"
>
- <%= comment.user.username[0].upcase %>
+ <%= comment.user.name[0].upcase %>
@@ -52,9 +52,9 @@
<% if Current.user == comment.user %>
-
<%= comment.user.username %>
+ <%= comment.user.name %>
<% else %>
- <%= comment.user.username %>
+ <%= comment.user.name %>
<% end %>
diff --git a/app/views/projects/_project_header.html.erb b/app/views/projects/_project_header.html.erb
index 7ae47f1d..d0be5c1d 100644
--- a/app/views/projects/_project_header.html.erb
+++ b/app/views/projects/_project_header.html.erb
@@ -90,11 +90,11 @@
text-white text-xs font-bold uppercase shrink-0
"
>
- <%= owner.username[0].upcase %>
+ <%= owner.name[0].upcase %>
<%= link_to participant_profile_course_path(course, owner.id, 'student'), class: "inline group/member hover:text-gray-700 underline decoration-transparent transition-colors duration-300 ease-in-out hover:decoration-current" do %>
- <%= owner.username %>
+ <%= owner.name %>
<% end %>
@@ -107,11 +107,11 @@
text-white text-xs font-bold uppercase shrink-0
"
>
- <%= user.username[0].upcase %>
+ <%= user.name[0].upcase %>
<%= link_to participant_profile_course_path(course, user.id, 'student'), class: "inline group/member hover:text-gray-900 underline decoration-transparent transition-colors duration-300 ease-in-out hover:decoration-current" do %>
- <%= user.username %>
+ <%= user.name %>
<% end %>
@@ -133,7 +133,7 @@
<%= link_to course_lecturer_path(course, current_instance.supervisor), class: "flex items-center justify-start gap-2 group/sup underline decoration-transparent transition-colors duration-300 ease-in-out hover:decoration-current" do %>
- <%= current_instance.supervisor.username %>
+ <%= current_instance.supervisor.name %>
<% end %>
@@ -268,7 +268,7 @@
"bg-gray-400"
end %>
- <%= username(current_instance.last_status_change_by) || "Not changed" %>
+ <%= name(current_instance.last_status_change_by) || "Not changed" %>
<% else %>
<%= image_tag("pending.svg", class: "w-4 h-4 opacity-50 shrink-0") %>
@@ -359,7 +359,7 @@
<% editor_id = current_instance.last_edit_by || current_instance.created_by_id %>
<%= image_tag("edit.svg", class: "w-4 h-4 opacity-50 shrink-0") %>
- <%= username(editor_id) || "Not changed" %>
+ <%= name(editor_id) || "Not changed" %>
diff --git a/app/views/projects/edit.html.erb b/app/views/projects/edit.html.erb
index 7dc594eb..dc5a4549 100644
--- a/app/views/projects/edit.html.erb
+++ b/app/views/projects/edit.html.erb
@@ -103,7 +103,7 @@
<% end %>
<% @lecturer_options.each do |lecturer_enrolment| %>
<% lecturer = lecturer_enrolment.user %>
-
+
<% approved_topics =
Topic.where(
status: :approved,
@@ -118,7 +118,7 @@
value="<%= topic.id %>"
<%= 'selected' if topic.id == @selected_topic_id %>
>
- <%= "#{lecturer.username} - #{current_instance&.title || "Untitled Topic"}" %>
+ <%= "#{lecturer.name} - #{current_instance&.title || "Untitled Topic"}" %>
<% end %>
@@ -127,7 +127,7 @@
<%= 'selected' if @selected_own_proposal_lecturer_id == lecturer_enrolment.id %>
class="text-blue-600 font-medium"
>
- <%= "#{lecturer.username} - Own Proposal" %>
+ <%= "#{lecturer.name} - Own Proposal" %>
<% end %>
diff --git a/app/views/projects/index.html.erb b/app/views/projects/index.html.erb
index 2cdcb023..30370b96 100644
--- a/app/views/projects/index.html.erb
+++ b/app/views/projects/index.html.erb
@@ -23,7 +23,7 @@
<% owner = project.ownership&.owner %>
<% if owner.is_a?(User) && @course.enrolments.exists?(user: owner, role: :student) %>
- Owner: <%= owner.username %>
+ Owner: <%= owner.name %>
<% end %>
<% if description_field.present? %>
diff --git a/app/views/projects/new.html.erb b/app/views/projects/new.html.erb
index 58408e00..9acf427e 100644
--- a/app/views/projects/new.html.erb
+++ b/app/views/projects/new.html.erb
@@ -104,7 +104,7 @@
<% end %>
<% @lecturer_options.each do |lecturer_enrolment| %>
<% lecturer = lecturer_enrolment.user %>
-
+
<% approved_topics =
Topic.where(
status: :approved,
@@ -119,7 +119,7 @@
value="<%= topic.id %>"
<%= 'selected' if topic.id.to_s == @selected_topic_id.to_s %>
>
- <%= "#{lecturer.username} - #{current_instance&.title || "Untitled Topic"}" %>
+ <%= "#{lecturer.name} - #{current_instance&.title || "Untitled Topic"}" %>
<% end %>
@@ -127,7 +127,7 @@
value="own_proposal_<%= lecturer.id %>"
class="text-blue-600 font-medium"
<%= 'selected' if @selected_topic_id.to_s == "own_proposal_#{lecturer.id}" %>>
- <%= "#{lecturer.username} - Own Proposal" %>
+ <%= "#{lecturer.name} - Own Proposal" %>
<% end %>
diff --git a/app/views/topics/_topbar.html.erb b/app/views/topics/_topbar.html.erb
index bef175ec..548178c9 100644
--- a/app/views/topics/_topbar.html.erb
+++ b/app/views/topics/_topbar.html.erb
@@ -1,5 +1,5 @@
-
<%= current_user.username %>'s Course View
+
<%= current_user.name %>'s Course View
<% if policy(@course).update? %>
diff --git a/app/views/topics/_topic_comments.html.erb b/app/views/topics/_topic_comments.html.erb
index 316e6fd6..ff617c0e 100644
--- a/app/views/topics/_topic_comments.html.erb
+++ b/app/views/topics/_topic_comments.html.erb
@@ -43,7 +43,7 @@
text-xs font-bold ring-4 ring-gray-50/30
"
>
- <%= comment.user.username[0].upcase %>
+ <%= comment.user.name[0].upcase %>
@@ -55,9 +55,9 @@
<% if Current.user == comment.user %>
-
<%= comment.user.username %>
+
<%= comment.user.name %>
<% else %>
-
<%= comment.user.username %>
+
<%= comment.user.name %>
<% end %>
diff --git a/app/views/topics/_topic_header.html.erb b/app/views/topics/_topic_header.html.erb
index b85f36b5..5ff07253 100644
--- a/app/views/topics/_topic_header.html.erb
+++ b/app/views/topics/_topic_header.html.erb
@@ -93,12 +93,12 @@
text-white text-xs font-bold uppercase shrink-0
"
>
- <%= owner.username[0].upcase %>
+ <%= owner.name[0].upcase %>
<%= link_to course_lecturer_path(course, owner), class: "flex items-center justify-start gap-2 group/sup underline decoration-transparent transition-colors duration-300 ease-in-out hover:decoration-current" do %>
- <%= owner.username %>
+ <%= owner.name %>
<% end %>
@@ -111,11 +111,11 @@
text-white text-xs font-bold uppercase shrink-0
"
>
- <%= user.username[0].upcase %>
+ <%= user.name[0].upcase %>
<%= link_to course_lecturer_path(course, user), class: "flex items-center justify-start gap-2 group/sup underline decoration-transparent transition-colors duration-300 ease-in-out hover:decoration-current" do %>
- <%= user.username %>
+ <%= user.name %>
<% end %>
@@ -250,7 +250,7 @@
"bg-gray-400"
end %>
-
<%= username(current_instance.last_status_change_by) || "Not changed" %>
+
<%= name(current_instance.last_status_change_by) || "Not changed" %>
<% else %>
<%= image_tag("pending.svg", class: "w-4 h-4 opacity-50 shrink-0") %>
@@ -335,7 +335,7 @@
<% editor_id = current_instance.last_edit_by || current_instance.created_by_id %>
<%= image_tag("edit.svg", class: "w-4 h-4 opacity-50 shrink-0") %>
- <%= username(editor_id) || "Not changed" %>
+ <%= name(editor_id) || "Not changed" %>
diff --git a/app/views/user/new_staff.html.erb b/app/views/user/new_staff.html.erb
index 947655f0..a2529035 100644
--- a/app/views/user/new_staff.html.erb
+++ b/app/views/user/new_staff.html.erb
@@ -19,7 +19,7 @@
<%= form.password_field :otp, required: true, placeholder: "OTP" %>
<%= form.password_field :password, required: true, autocomplete: "current-password", placeholder: "Enter your password", maxlength: 72 %>
<%= form.password_field :password_confirmation, required: true, placeholder: "Enter password confirmation", maxlength: 72 %>
- <%= form.search_field :username, placeholder: "Name", required: true %>
+ <%= form.search_field :name, placeholder: "Name", required: true %>
<%= form.submit "Create Account" %>
<% end %>
diff --git a/app/views/user/profile.html.erb b/app/views/user/profile.html.erb
index 97526bc4..8e18fa85 100644
--- a/app/views/user/profile.html.erb
+++ b/app/views/user/profile.html.erb
@@ -116,8 +116,8 @@
- <%= form.label :username, "Username", class: label_classes %>
- <%= form.text_field :username, class: input_classes, placeholder: "e.g. jdoe123" %>
+ <%= form.label :name, "Name", class: label_classes %>
+ <%= form.text_field :name, class: input_classes, placeholder: "e.g. jdoe123" %>
diff --git a/config/breadcrumbs.rb b/config/breadcrumbs.rb
index 8f7ebb2c..631a3b94 100644
--- a/config/breadcrumbs.rb
+++ b/config/breadcrumbs.rb
@@ -88,7 +88,7 @@
participant_name = if params[:participant_type] == 'group'
ProjectGroup.find(params[:from_participant]).group_name
else
- User.find(params[:from_participant]).username
+ User.find(params[:from_participant]).name
end
parent :course_participant_profile, project.course, participant_name
else
@@ -124,7 +124,7 @@
end
crumb :lecturer do |course, lecturer|
- link lecturer.username, course_lecturer_path(course, lecturer)
+ link lecturer.name, course_lecturer_path(course, lecturer)
parent :course, course
end
diff --git a/db/migrate/20260405032531_rename_student_id_to_inst_id.rb b/db/migrate/20260405032531_rename_student_id_to_inst_id.rb
new file mode 100644
index 00000000..7b8a0e7b
--- /dev/null
+++ b/db/migrate/20260405032531_rename_student_id_to_inst_id.rb
@@ -0,0 +1,6 @@
+class RenameStudentIdToInstId < ActiveRecord::Migration[8.0]
+ def change
+ rename_column :users, :username, :name
+ rename_column :users, :student_id, :instid
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 724e70d1..d2b345fe 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
-ActiveRecord::Schema[8.0].define(version: 2026_04_03_045543) do
+ActiveRecord::Schema[8.0].define(version: 2026_04_05_032531) do
create_table "comments", force: :cascade do |t|
t.integer "user_id", null: false
t.string "text", null: false
@@ -292,9 +292,9 @@
create_table "users", force: :cascade do |t|
t.string "email_address", null: false
t.string "password_digest", null: false
- t.string "username", null: false
+ t.string "name", null: false
t.boolean "has_registered", null: false
- t.string "student_id"
+ t.string "instid"
t.string "web_link"
t.boolean "is_staff", null: false
t.datetime "created_at", null: false
diff --git a/db/seeds.rb b/db/seeds.rb
index 7fdda3f4..e4d8d0e6 100644
--- a/db/seeds.rb
+++ b/db/seeds.rb
@@ -1,9 +1,9 @@
# Create Users
lecturer1 = User.create!(
email_address: 'lecturer1@test.com',
- username: 'lecturer1',
+ name: 'lecturer1',
has_registered: true,
- student_id: nil,
+ instid: nil,
web_link: 'test.com',
is_staff: true,
password: 'password123'
@@ -11,9 +11,9 @@
lecturer2 = User.create!(
email_address: 'lecturer2@test.com',
- username: 'lecturer2',
+ name: 'lecturer2',
has_registered: true,
- student_id: nil,
+ instid: nil,
web_link: 'test.com',
is_staff: true,
password: 'password123'
@@ -21,9 +21,9 @@
lecturer3 = User.create!(
email_address: 'lecturer3@test.com',
- username: 'lecturer3',
+ name: 'lecturer3',
has_registered: true,
- student_id: nil,
+ instid: nil,
web_link: 'test.com',
is_staff: true,
password: 'password123'
@@ -31,135 +31,135 @@
student1 = User.create!(
email_address: 'student1@test.com',
- username: 'student1',
+ name: 'student1',
has_registered: true,
- student_id: '1191202123',
+ instid: '1191202123',
is_staff: false,
password: 'password123'
)
student2 = User.create!(
email_address: 'student2@test.com',
- username: 'student2',
+ name: 'student2',
has_registered: true,
- student_id: '1191202124',
+ instid: '1191202124',
is_staff: false,
password: 'password123'
)
student3 = User.create!(
email_address: 'student3@test.com',
- username: 'student3',
+ name: 'student3',
has_registered: true,
- student_id: '1191202125',
+ instid: '1191202125',
is_staff: false,
password: 'password123'
)
student4 = User.create!(
email_address: 'student4@test.com',
- username: 'student4',
+ name: 'student4',
has_registered: true,
- student_id: '1191202126',
+ instid: '1191202126',
is_staff: false,
password: 'password123'
)
student5 = User.create!(
email_address: 'student5@test.com',
- username: 'student5',
+ name: 'student5',
has_registered: true,
- student_id: '1191202126',
+ instid: '1191202126',
is_staff: false,
password: 'password123'
)
student6 = User.create!(
email_address: 'student6@test.com',
- username: 'student6',
+ name: 'student6',
has_registered: true,
- student_id: '1191202127',
+ instid: '1191202127',
is_staff: false,
password: 'password123'
)
student7 = User.create!(
email_address: 'student7@test.com',
- username: 'student7',
+ name: 'student7',
has_registered: true,
- student_id: '1191202128',
+ instid: '1191202128',
is_staff: false,
password: 'password123'
)
student8 = User.create!(
email_address: 'student8@test.com',
- username: 'student8',
+ name: 'student8',
has_registered: true,
- student_id: '1191202129',
+ instid: '1191202129',
is_staff: false,
password: 'password123'
)
student9 = User.create!(
email_address: 'student9@test.com',
- username: 'student9',
+ name: 'student9',
has_registered: true,
- student_id: '1191202130',
+ instid: '1191202130',
is_staff: false,
password: 'password123'
)
student10 = User.create!(
email_address: 'student10@test.com',
- username: 'student10',
+ name: 'student10',
has_registered: true,
- student_id: '1191202131',
+ instid: '1191202131',
is_staff: false,
password: 'password123'
)
student11 = User.create!(
email_address: 'student11@test.com',
- username: 'student11',
+ name: 'student11',
has_registered: true,
- student_id: '1191202132',
+ instid: '1191202132',
is_staff: false,
password: 'password123'
)
student12 = User.create!(
email_address: 'student12@test.com',
- username: 'student12',
+ name: 'student12',
has_registered: true,
- student_id: '1191202133',
+ instid: '1191202133',
is_staff: false,
password: 'password123'
)
student13 = User.create!(
email_address: 'student13@test.com',
- username: 'student13',
+ name: 'student13',
has_registered: true,
- student_id: '1191202133',
+ instid: '1191202133',
is_staff: false,
password: 'password123'
)
student14 = User.create!(
email_address: 'student14@test.com',
- username: 'student14',
+ name: 'student14',
has_registered: true,
- student_id: '1191202134',
+ instid: '1191202134',
is_staff: false,
password: 'password123'
)
student15 = User.create!(
email_address: 'student15@test.com',
- username: 'student15',
+ name: 'student15',
has_registered: true,
- student_id: '1191202135',
+ instid: '1191202135',
is_staff: false,
password: 'password123'
)
diff --git a/lib/tasks/remove_student_id_prefix.rake b/lib/tasks/remove_student_id_prefix.rake
index 9614b616..6562a4c9 100644
--- a/lib/tasks/remove_student_id_prefix.rake
+++ b/lib/tasks/remove_student_id_prefix.rake
@@ -3,11 +3,11 @@
namespace :one_time do
desc "Remove 'S-' prefix from student IDs in the database"
task remove_student_id_prefix: :environment do
- User.where('student_id LIKE ?', 'S-%').find_each do |user|
- old_id = user.student_id
- user.student_id = user.student_id.sub(/^S-/, '')
+ User.where('instid LIKE ?', 'S-%').find_each do |user|
+ old_id = user.instid
+ user.instid = user.instid.sub(/^S-/, '')
if user.save
- puts "Updated student ID for User ID #{user.id} (#{old_id} -> #{user.student_id})"
+ puts "Updated student ID for User ID #{user.id} (#{old_id} -> #{user.instid})"
else
puts "Failed to update User ID #{user.id}: #{user.errors.full_messages.join(', ')}"
end
diff --git a/test/factories/users.rb b/test/factories/users.rb
index 01f80bf0..79ccb783 100644
--- a/test/factories/users.rb
+++ b/test/factories/users.rb
@@ -1,15 +1,15 @@
FactoryBot.define do
factory :user do
- username { Faker::Name.name }
+ name { Faker::Name.name }
email_address { Faker::Internet.unique.email }
password { 'password' }
is_staff { false }
has_registered { true }
- student_id { Faker::Alphanumeric.alphanumeric(number: 8) }
+ instid { Faker::Alphanumeric.alphanumeric(number: 8) }
trait :staff do
is_staff { true }
- student_id { nil }
+ instid { nil }
end
end
end