Skip to content

Commit

Permalink
PG Student updates
Browse files Browse the repository at this point in the history
  • Loading branch information
NuwanJ-RhinoPartners committed Oct 16, 2023
1 parent fa3055d commit 24cc573
Show file tree
Hide file tree
Showing 19 changed files with 78 additions and 46 deletions.
Binary file modified images/students/postgraduate/ASubramaniam.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/students/postgraduate/HMWMHippola.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/students/postgraduate/IUEkanayake.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/students/postgraduate/MRasendram.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/students/postgraduate/WDMGMDissanayake.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions pages/postgraudate/students/ASubramaniam.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
---
layout: postgraduateDetails
permalink: "/students/postgraduate/ASubramaniam/"
title: A Subramaniam
index_in_card_list: 422271
title: A. Subramaniam
index_in_card_list: 402471

reg_no: PG/MPhil/16/03
name_with_initials: A Subramaniam
name_with_initials: A. Subramaniam
email: [email protected]
url_website: #
degree: MPhil
Expand Down
6 changes: 3 additions & 3 deletions pages/postgraudate/students/GRomiyal.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
---
layout: postgraduateDetails
permalink: "/students/postgraduate/GRomiyal/"
title: G.Romiyal
index_in_card_list: 40413328
title: G. Romiyal
index_in_card_list: 40393528

reg_no: PG/MPhil/22/09
name_with_initials: G.Romiyal
name_with_initials: G. Romiyal
email: [email protected]
url_website: #
degree: MPhil
Expand Down
6 changes: 3 additions & 3 deletions pages/postgraudate/students/HMWMHippola.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
---
layout: postgraduateDetails
permalink: "/students/postgraduate/HMWMHippola/"
title: H M W M Hippola
index_in_card_list: 2793211
title: H.M.W.M. Hippola
index_in_card_list: 2773411

reg_no: PG/MPhil/20/12
name_with_initials: H M W M Hippola
name_with_initials: H.M.W.M. Hippola
email: [email protected]
url_website: https://www.linkedin.com/in/warunikahippolawusl/
degree: MPhil
Expand Down
6 changes: 3 additions & 3 deletions pages/postgraudate/students/IUEkanayake.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
---
layout: postgraduateDetails
permalink: "/students/postgraduate/IUEkanayake/"
title: IU Ekanayake
index_in_card_list: 472556
title: I.U. Ekanayake
index_in_card_list: 452756

reg_no: Provisional
name_with_initials: IU Ekanayake
name_with_initials: I.U. Ekanayake
email: [email protected]
url_website: https://www.linkedin.com/in/imesh-ekanayake/
degree: MPhil
Expand Down
16 changes: 16 additions & 0 deletions pages/postgraudate/students/KMPTAbeyrathne.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
layout: postgraduateDetails
permalink: "/students/postgraduate/KMPTAbeyrathne/"
title: K.M.P.T. Abeyrathne
index_in_card_list: 43244728

reg_no: PG/PhD/15/02
name_with_initials: K.M.P.T. Abeyrathne
email: [email protected]
url_website: #
degree: PhD
mode_of_study: Part Time
research_topic: Formally Verified Hardware Accellerated Implementation of TCP protocol

image_url: "images/students/postgraduate/KMPTAbeyrathne.jpg"
---
6 changes: 3 additions & 3 deletions pages/postgraudate/students/KSanthanakrishnan.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
---
layout: postgraduateDetails
permalink: "/students/postgraduate/KSanthanakrishnan/"
title: K.Santhanakrishnan
index_in_card_list: 40380743
title: K. Santhanakrishnan
index_in_card_list: 40360943

reg_no: Provisional
name_with_initials: K.Santhanakrishnan
name_with_initials: K. Santhanakrishnan
email: [email protected]
url_website: #
degree: PhD
Expand Down
2 changes: 1 addition & 1 deletion pages/postgraudate/students/KSuthesan.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
layout: postgraduateDetails
permalink: "/students/postgraduate/KSuthesan/"
title: K.Suthesan
index_in_card_list: 20101495
index_in_card_list: 20081695

reg_no: #
name_with_initials: K.Suthesan
Expand Down
6 changes: 3 additions & 3 deletions pages/postgraudate/students/MRasendram.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
---
layout: postgraduateDetails
permalink: "/students/postgraduate/MRasendram/"
title: M Rasendram
index_in_card_list: 456743
title: M. Rasendram
index_in_card_list: 436943

reg_no: Provisional
name_with_initials: M Rasendram
name_with_initials: M. Rasendram
email: [email protected]
url_website: #
degree: MPhil
Expand Down
2 changes: 1 addition & 1 deletion pages/postgraudate/students/PRukshani.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
layout: postgraduateDetails
permalink: "/students/postgraduate/PRukshani/"
title: P. Rukshani
index_in_card_list: 40382861
index_in_card_list: 40363061

reg_no: #
name_with_initials: P. Rukshani
Expand Down
6 changes: 3 additions & 3 deletions pages/postgraudate/students/SMAJSenanayake.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
---
layout: postgraduateDetails
permalink: "/students/postgraduate/SMAJSenanayake/"
title: SMAJ Senanayake
index_in_card_list: 411941
title: S.M.A.J. Senanayake
index_in_card_list: 392141

reg_no: PG/Mphil/20/14
name_with_initials: SMAJ Senanayake
name_with_initials: S.M.A.J. Senanayake
email: [email protected]
url_website: https://www.linkedin.com/in/anjanasenanayake/
degree: MPhil
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
---
layout: postgraduateDetails
permalink: "/students/postgraduate/RoshanWBPK/"
title: Roshan W.B.P.K
index_in_card_list: 2192914
permalink: "/students/postgraduate/WBPKRoshan/"
title: W.B.P.K. Roshan
index_in_card_list: 2173114

reg_no: #
name_with_initials: Roshan W.B.P.K
name_with_initials: W.B.P.K. Roshan
email: [email protected]
url_website: #
degree: PhD
Expand Down
2 changes: 1 addition & 1 deletion pages/postgraudate/students/WDMGMDissanayake.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
layout: postgraduateDetails
permalink: "/students/postgraduate/WDMGMDissanayake/"
title: W.D.M.G.M. Dissanayake
index_in_card_list: 1091057
index_in_card_list: 1071257

reg_no: PG/MPhil/15/09
name_with_initials: W.D.M.G.M. Dissanayake
Expand Down
52 changes: 34 additions & 18 deletions python_scripts/update_postgrad_from_google_form.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@
import json

googleFromCSV_link = "https://docs.google.com/spreadsheets/d/e/2PACX-1vR6ntuDUUuzQS84Am7NMcCc6LCTYKmUfMbVhp4dvy1AXWoVxNrjWfeQntWg5cAfLsFvb4WASQRp-erT/pub?output=csv"
googleFromCSV = requests.get(googleFromCSV_link, headers={
'Cache-Control': 'no-cache'}).text.split("\n")
googleFromCSV = requests.get(
googleFromCSV_link, headers={"Cache-Control": "no-cache"}
).text.split("\n")

# Index of the CSV parameters
FORM_FILLED_DATE = 0
Expand All @@ -33,54 +34,69 @@
if __name__ == "__main__":
try:
# shutil.rmtree('../images/students/postgraduate/')
shutil.rmtree('../pages/postgraudate/students')
shutil.rmtree("../pages/postgraudate/students")
except OSError as e:
print("Error: %s : %s" % ('Directory remove failed', e.strerror))
print("Error: %s : %s" % ("Directory remove failed", e.strerror))

for eachLine in googleFromCSV:
studentData = eachLine.replace('\r', '').split(",")
studentData = eachLine.replace("\r", "").split(",")

if ":" not in studentData[0]:
# if there is no timestamp in this line or this is the header line
continue

# calcualte a number from the time the form is filled
# based on the time elapsed from the start of time (1970 something)
parsedDateTimeObject = datetime.datetime.strptime(studentData[FORM_FILLED_DATE], "%m/%d/%Y %H:%M:%S")
parsedDateTimeObject = datetime.datetime.strptime(
studentData[FORM_FILLED_DATE], "%m/%d/%Y %H:%M:%S"
)
elapsedTimeFromTheStartOfTime = parsedDateTimeObject.timestamp() - 1654224090
print(int(elapsedTimeFromTheStartOfTime))

# print(studentData)
print("Processing: " + studentData[REG_NO] + " " + studentData[NAME_WITH_INITIALS])
print(
"Processing: " + studentData[REG_NO] + " " + studentData[NAME_WITH_INITIALS]
)

print(json.dumps(studentData, indent=4))

nameConverted = studentData[NAME_WITH_INITIALS].replace(" ", "").replace(".", "")
nameConverted = (
studentData[NAME_WITH_INITIALS].replace(" ", "").replace(".", "")
)
permalink = f"/students/postgraduate/{nameConverted}/"

# image
image_path = f"images/students/postgraduate/{nameConverted}.jpg"
os.makedirs(os.path.dirname(image_path), exist_ok=True)

isImageDownloaded = False
if studentData[PROFILE_PIC_LINK] != "" and len(studentData[PROFILE_PIC_LINK]) > 1:
print(f"Downloading image to {image_path}")
isImageDownloaded = True
# print(len(studentData[URL_IMAGE]))
gdown.download("https://drive.google.com/uc?id=" +
studentData[PROFILE_PIC_LINK].split("=")[1].strip(), "../"+image_path, quiet=True)

if (
studentData[PROFILE_PIC_LINK] != ""
and len(studentData[PROFILE_PIC_LINK]) > 1
):
if not os.path.exists("../" + image_path):
print(f"Downloading image to {image_path}")
isImageDownloaded = True
# print(studentData[PROFILE_PIC_LINK])
gdown.download(
"https://drive.google.com/uc?id="
+ studentData[PROFILE_PIC_LINK].split("=")[1].strip(),
"../" + image_path,
quiet=True,
)
else:
print("Profile pic is already there")
else:
image_path = "images/students/default.jpg"
print("Image not specified")

# add # to all empty fields
for i in range(0, WEBSITE_URL+1):
for i in range(0, WEBSITE_URL + 1):
if studentData[i] == "":
studentData[i] = "#"

reg_number = studentData[REG_NO]
if(reg_number.lower() == "provisional"):
if reg_number.lower() == "provisional":
# Some will not type it in the correct case
reg_number = "Provisional"

Expand All @@ -102,7 +118,7 @@
---"""

# write to html file
file_url = "../"+f"pages/postgraudate/students/{nameConverted}.html"
file_url = "../" + f"pages/postgraudate/students/{nameConverted}.html"
os.makedirs(os.path.dirname(file_url), exist_ok=True)
htmlFile = open(file_url, "w")
print(f"Writing to {file_url}")
Expand Down

0 comments on commit 24cc573

Please sign in to comment.