From 8900ee75368a70dbee14682f67cd02a73ddba84e Mon Sep 17 00:00:00 2001
From: Jarko Papalitsas <jastpa@utu.fi>
Date: Wed, 28 Feb 2024 17:38:56 +0200
Subject: [PATCH] Minor changes for testing

---
 juttu.py             |  6 ++++--
 load_realizations.sh |  3 +++
 ssh-api-tunnel.sh    | 11 +++++++++++
 3 files changed, 18 insertions(+), 2 deletions(-)
 mode change 100644 => 100755 juttu.py
 create mode 100755 load_realizations.sh
 create mode 100755 ssh-api-tunnel.sh

diff --git a/juttu.py b/juttu.py
old mode 100644
new mode 100755
index 372c850..0a3f17a
--- a/juttu.py
+++ b/juttu.py
@@ -1,3 +1,5 @@
+#!/bin/env python3
+
 import json
 import datetime
 from html_elements import *
@@ -103,8 +105,8 @@ def realization_div(realization):
     content += span("Opintopisteet: " + str(int(realization['credits'])))
     content += span(f"Kurssin ajankohta: {format_date(realization['startDate'])} - {format_date(realization['endDate'])}")
     content += span(f"Ilmoittautuminen: {format_date(realization['enrollmentStart'])} - {format_date(realization['enrollmentEnd'])}")
-    if realization['localizedContent']['valueFi']:
-        content += details("Sisältö: ", realization['localizedContent']['valueFi'])
+    if realization['localizedObjective']['valueFi']:
+        content += details("Oppimistavoitteet: ", realization['localizedObjective']['valueFi'])
     return div(content, class_name="realization")
     
 for faculty in faculties:
diff --git a/load_realizations.sh b/load_realizations.sh
new file mode 100755
index 0000000..fede163
--- /dev/null
+++ b/load_realizations.sh
@@ -0,0 +1,3 @@
+#!/bin/env bash
+source './.env'
+curl -k -v -XPOST  -H "Host: api-ext.utu.fi" -H "X-Api-Key: $TT_APIUMBRELLA" -u"$TT_OPENDATA:" -H "ESP-ScreenName: $EPPN" -H "Content-type: application/json" -H "Accept: application/json" https://localhost:8081/peppi/opendata/r1/tt/tulevattoteutukset -d "{\"status\": [\"PUBLISHED\"]}" -o realizations.json
diff --git a/ssh-api-tunnel.sh b/ssh-api-tunnel.sh
new file mode 100755
index 0000000..9b80055
--- /dev/null
+++ b/ssh-api-tunnel.sh
@@ -0,0 +1,11 @@
+#! /usr/bin/env sh
+
+if [ $# -lt 1 ]; then
+    username="$USER"
+fi
+
+if [ $# -ge 1 ]; then
+    username="$1"
+fi
+
+ssh -N -L 127.0.0.1:8080:api-ext.utu.fi:80 -L 127.0.0.1:8081:api-ext.utu.fi:443 "$username"@peppiext.utu.fi
-- 
GitLab