Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add location to "Scheduled" lectures on course page #1376

Merged
merged 19 commits into from
Oct 21, 2024

Conversation

KemalKrKX
Copy link
Contributor

Motivation and Context

Under scheduled lectures a new link to lecture hall webpage on NavigaTUM is added.
The issue: #1193

Description

The lecture hall information of scheduled lectures is used to query NavigaTUM.

Steps for Testing

Prerequisites:

  • 1 Module
  1. Log in
  2. Create a new scheduled lecture for the module
  3. Go to lecture homepage on TUMLive

Local copies of TUMLive don't update the lecture hall information, so no link is displayed there. However a reviewer can manually set a RoomCode for the lecture in order to observe the change.

Copy link

github-actions bot commented Sep 5, 2024

Your Testserver will be ready at https://1376.test.live.mm.rbg.tum.de in a few minutes.

Logins
Kurs1 Kurs2 Kurs3 Kurs4
public public loggedin enrolled
prof1 prof1 prof2 prof1
prof2
student1
student2
student3
student1
student2
student2
student3
student1
student2

@@ -567,7 +567,9 @@
</section>
</template>
<template x-if="plannedStreams.hasElements()">
<section class="tum-live-course-view-item px-3">
<section x-data="{isLectureHallValid(lectureHall) {const regex = /^\d{4}\.[A-Z0-9]{2}\.[A-Z0-9]{3,4}$/;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please move this function into the corresponding typescript file. Especially functions shouldn't be in the x-data property as this should only contain data.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I created a lecture-hall-validator.ts in the /web/ts/utilities, but I am having problems determining where Alpinejs is initialized so that i can import and use this validator. Do you happen to know where it is?

web/template/home.gohtml Outdated Show resolved Hide resolved
return regex.test(lectureHall);
}

declare global {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need this declare global here? Wouldn't it be enough to just export the function and use it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Theoretically it should suffice, but my local copy would not use this function unless I made it global. I can try making it work without the global declaration if it is an issue.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't have unnecessary global definitions so it would be better to change it

@CommanderStorm CommanderStorm changed the title 1193 lecture halls feat: add location to "Scheduled" lectures on course page Oct 7, 2024
@KemalKrKX
Copy link
Contributor Author

Couldn't get the validator from a separate utility file to work with the website template even after testing various methods. Moved the script inside the home.gohtml instead. Hope this is alright.

@KemalKrKX KemalKrKX requested a review from SebiWrn October 7, 2024 19:24
@KemalKrKX KemalKrKX self-assigned this Oct 8, 2024
@SebiWrn
Copy link
Collaborator

SebiWrn commented Oct 10, 2024

I'm sorry but we just have to put that code into the .ts files.
Why couldn't you get it to these files, what's your error?

@KemalKrKX
Copy link
Contributor Author

KemalKrKX commented Oct 10, 2024

I am not entirely sure what the exact cause is, but when I export the function to a seperate file the check breaks. A global definition solves this, so i believe the file/function is out of scope, however every bypass i could think until now caused further problems.

@@ -566,6 +567,7 @@
</section>
</section>
</template>
<div x-data="{ isLectureHallValid }">
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this data Tag necessary? I think you don't need it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, it is part of another change that i scrapped and it seems i forgot to delete it later on.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But now you again included these lines.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I forgot I changed these lines on Github directly and when I pushed my local it must have overridden the change.

@SebiWrn
Copy link
Collaborator

SebiWrn commented Oct 17, 2024

Is the update of the package-lock.json really needed? If not, we should do this in a different PR so we can locate errors in the git log more easily.
If this didn't happen on purpose, please use npm ci instead of npm i because then the package-lock isn't changed.

@KemalKrKX
Copy link
Contributor Author

This is a byproduct of me using npm i to recompile tailwind. After checking what changed, I saw they were mostly dependency changes to newer versions (saying mostly because to be honest I have not checked each and every one) and gocast was working so I left them as is. However as far as I understand, after this PR is merged, a new installation would change this file again anyway since npm i is used during the setup process. Would you rather prefer these changes to be rolled back entirely or transferred to a new PR?

@SebiWrn
Copy link
Collaborator

SebiWrn commented Oct 17, 2024

I think we can rollback these changes and if we need we can do a full upgrade of every dependency in our project in another PR sometime.
Btw npm ci basically does the same as npm i but doesn't change the dependencies.

@KemalKrKX
Copy link
Contributor Author

KemalKrKX commented Oct 18, 2024

The package-lock.json file is replaced with its counterpart from dev branch. However I also noticed some small files have also been changed indirectly, so I pushed them too to be safe. The only commands I have used that may have caused this are go get ./..., npm audit fix and npm fund. I can also reset them to their dev counterparts if need be.

@KemalKrKX KemalKrKX requested a review from SebiWrn October 18, 2024 17:15
@@ -566,6 +567,7 @@
</section>
</section>
</template>
<div x-data="{ isLectureHallValid }">
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But now you again included these lines.

@KemalKrKX KemalKrKX requested a review from SebiWrn October 20, 2024 12:18
@SebiWrn SebiWrn merged commit e20c189 into dev Oct 21, 2024
8 checks passed
@SebiWrn SebiWrn deleted the 1193-lectureHalls branch October 21, 2024 13:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants