FET Forum

FET Development => Suggestions => Topic started by: infoo_ on February 21, 2025, 06:05:55 AM

Title: Teacher not available times - Button for swap X with empty
Post by: infoo_ on February 21, 2025, 06:05:55 AM
Hello

I had a hard time confusing crosses (not available) with empty spaces (available) in Teacher not available times constraint menu.

Most teachers do not cover all hours, so it would save a lot of time to only check the available boxes, instead of unchecking the unavailable ones.

I know that I can mark everything with X and then unmark those that I need, but it takes longer and visually I get lost. It would be better to do it the other way around.

Is it possible to add this feature?

Thank you!
Title: Re: Teacher not available times - Button for swap X with empty
Post by: Liviu Lalescu on February 21, 2025, 07:31:04 AM
Hello,

Can't you press "Toggle all" more times?
Title: Re: Teacher not available times - Button for swap X with empty
Post by: infoo_ on February 21, 2025, 07:49:16 AM
Quote from: Liviu Lalescu on February 21, 2025, 07:31:04 AMCan't you press "Toggle all" more times?

Pressing that button several times checks/unchecks all slots. What I mean is when adding a new constraint
Title: Re: Teacher not available times - Button for swap X with empty
Post by: Liviu Lalescu on February 21, 2025, 08:51:18 AM
I added this in the TODO, but I don't agree/like.
Title: Re: Teacher not available times - Button for swap X with empty
Post by: infoo_ on February 21, 2025, 12:14:43 PM
Quote from: Liviu Lalescu on February 21, 2025, 08:51:18 AMI added this in the TODO, but I don't agree/like.


Thanks  ;D

Teachers are asked to fill a form with times. For them, it is easier to check they available times rather than uncheck slots. When a slot is filled, a checkmark is added (instead a cross).

When the administrator loads the data into FET, what would be easier? Checking a few slots or unchecking a lot of slots?

I see it in that way
Title: Re: Teacher not available times - Button for swap X with empty
Post by: Liviu Lalescu on February 21, 2025, 12:17:51 PM
The FET terminology is that constraint teacher not available times denies some slots. Teacher available times means that teachers who have no such constraint are not available at all?
Title: Re: Teacher not available times - Button for swap X with empty
Post by: infoo_ on February 21, 2025, 12:31:16 PM
Quote from: Liviu Lalescu on February 21, 2025, 12:17:51 PMThe FET terminology is that constraint teacher not available times denies some slots. Teacher available times means that teachers who have no such constraint are not available at all?


We don't have teachers with no such constraint.

For simplicity, maybe marking with crosses its available times and then pushing a button that converts cross to empty and empty to cross would be easier to implement. It is like swapping 0's to 1's, and vice versa

I am using the Official mode
Title: Re: Teacher not available times - Button for swap X with empty
Post by: Liviu Lalescu on February 21, 2025, 12:35:57 PM
This is a good idea.

It is very easy to change the symbols, but I am afraid of possible wrong uses. I'll think of the idea.

Meanwhile, do you know that you can enable colors in interface (from the Settings) and available will be green and X will be red? Maybe you can work better in this way.
Title: Re: Teacher not available times - Button for swap X with empty
Post by: infoo_ on February 21, 2025, 10:20:34 PM
Quote from: Liviu Lalescu on February 21, 2025, 12:35:57 PMIt is very easy to change the symbols, but I am afraid of possible wrong uses. I'll think of the idea.

No change at all. I mean for example creating a button like this:

Swap-button.png

When clicking on Swap, the slots change to:

After-swap.png

I think it would be useful, and people won't confuse.

Quote from: Liviu Lalescu on February 21, 2025, 12:35:57 PMMeanwhile, do you know that you can enable colors in interface (from the Settings) and available will be green and X will be red? Maybe you can work better in this way.

Ooh didn't know about that interface submenu! Thank you for the suggestion, Liviu
Title: Re: Teacher not available times - Button for swap X with empty
Post by: Liviu Lalescu on February 21, 2025, 10:31:04 PM
Good suggestion! I'll see what I can do.

So the functions will stay the same, but only add a button "Swap" which does not affect the constraint, but only invert all the table?
Title: Re: Teacher not available times - Button for swap X with empty
Post by: infoo_ on February 21, 2025, 10:35:32 PM
Quote from: Liviu Lalescu on February 21, 2025, 10:31:04 PMSo the functions will stay the same, but only add a button "Swap" which does not affect the constraint, but only invert all the table?

Exactly! After clicking it, we can then click Add constraint and save as it is. Also the button should be present when editing a constraint
Title: Re: Teacher not available times - Button for swap X with empty
Post by: Liviu Lalescu on February 21, 2025, 10:37:16 PM
I'll try.
Title: Re: Teacher not available times - Button for swap X with empty
Post by: Volker Dirr on February 22, 2025, 10:38:08 AM
hmm... reminds me, that the "toggle all" button might be unneeded at all, since in "normal" case that should be done by pressing on the empty cell in the upper left corner (so in the header, where you can see the hour and days names). But that feature is currently not included.
Title: Re: Teacher not available times - Button for swap X with empty
Post by: Liviu Lalescu on February 22, 2025, 11:06:05 AM
Thank you, infoo_, for the good suggestion! I just released the new version.

Volker, I knew this is a good approach, and tried it, but Qt QTableWidget/QTableView does not react/include to clicking on the upper-left corner.
Title: Re: Teacher not available times - Button for swap X with empty
Post by: Volker Dirr on February 22, 2025, 11:21:51 AM
Maybe we should write a Qt feature request?
Title: Re: Teacher not available times - Button for swap X with empty
Post by: gradgrind on February 22, 2025, 12:31:55 PM
I know you have done this now, but QTableView does have a way of getting a click on the corner button. It may not be ideal, but clicking on the corner button calls the slot "selectAll", which you can override in a subclass.
Title: Re: Teacher not available times - Button for swap X with empty
Post by: Liviu Lalescu on February 22, 2025, 01:26:06 PM
Thank you! I am not sure, but I think I tried this approach some time ago and I could not. Maybe I tried this same approach, but the table selection is set to none.

I might try this approach, soon, but not now, because I just released the new version. I will let you know.
Title: Re: Teacher not available times - Button for swap X with empty
Post by: Liviu Lalescu on February 22, 2025, 06:44:05 PM
@gradgrind ,

I tried, and on a small example it works, but in FET it doesn't work. Maybe you would like to try it - I attach the code (k.cpp and t-try.pro are a small test, and work, but the two add... .h & .cpp do not work - they should be placed in fet-7.0.4/interface - you can diff them with the official files).

@Volker Dirr , maybe you would like also to have a look.

PS: Only works in unix (on Windows, you don't have a command-line interface).
Title: Re: Teacher not available times - Button for swap X with empty
Post by: infoo_ on February 22, 2025, 08:21:00 PM
Thank you for the implementation, Liviu and team! It works smoothly :)
Title: Re: Teacher not available times - Button for swap X with empty
Post by: gradgrind on February 23, 2025, 05:56:09 AM
I had a look at the code. If you delete the call "setStretchAvailabilityTableNicely(timesTable)" in addormodifytimeconstraint.cpp, the corner click works. Is there a reason why this call was there?

Also, "timesTable->setCornerButtonEnabled(true)" is not necessary as this is the default (of course, putting it in makes it explicit, which might be a good thing).

But maybe the version with the swap button is better (clearer) anyway?
Title: Re: Teacher not available times - Button for swap X with empty
Post by: Liviu Lalescu on February 23, 2025, 08:21:22 AM
Hmm... thank you for your observation! Indeed, in "setStretchAvailabilityTableNicely(timesTable)" I do a setCornerButtonEnabled(false), I don't know why. So, I assume if I set this to true, it will work.

@gradgrind , @infoo_ , @Volker Dirr , please tell me, how is it better, in your opinion? To remove the button "Toggle all" and the user needs to click on the corner, or leave as it is now? I am afraid users won't know to press on the corner.

Also, if we implement the corner and remove a button, I think best would be to remove "Swap" and leave "Toggle all", and Toggle all will invert all the cells (as does Swap now).
Title: Re: Teacher not available times - Button for swap X with empty
Post by: Liviu Lalescu on February 23, 2025, 09:55:58 AM
I think it is best to add the corner behavior, remove "Swap" and make "Toggle all" to invert all cells. I will do this now. But if you object, I will revert.
Title: Re: Teacher not available times - Button for swap X with empty
Post by: Volker Dirr on February 23, 2025, 11:03:43 AM
Less then 2 hours time to answer? Liviu, you are too fast.
But I think both variants are ok. You can choose. If you are not sure, you might even do both: Support the button and the corner.
Title: Re: Teacher not available times - Button for swap X with empty
Post by: infoo_ on February 23, 2025, 03:36:29 PM
Quote from: Liviu Lalescu on February 23, 2025, 09:55:58 AMI think it is best to add the corner behavior, remove "Swap" and make "Toggle all" to invert all cells. I will do this now. But if you object, I will revert.


I agree with you
Title: Re: Teacher not available times - Button for swap X with empty
Post by: infoo_ on February 23, 2025, 03:39:31 PM
Corner behaviour is present in, for example, Excel with a small icon:

Corner-Excel.png

Maybe it can be implemented in FET for warning users there is a functionality there
Title: Re: Teacher not available times - Button for swap X with empty
Post by: Liviu Lalescu on February 23, 2025, 04:28:15 PM
I searched the internet and it seems it is possible to style/put an icon on the top-left corner, but I am not sure which icon would be best. I prefer to keep the default (none), hoping users will know.

Also, the corner may be smaller or larger, depending on the hours' names.

I did this, it is working. I will put a snapshot soon (I am waiting for feed-back on another suggestion).
Title: Re: Teacher not available times - Button for swap X with empty
Post by: infoo_ on February 23, 2025, 04:50:39 PM
Quote from: Liviu Lalescu on February 23, 2025, 04:28:15 PMAlso, the corner may be smaller or larger, depending on the hours' names.

Agree

Maybe not an icon but this concepts seem to fit nicely:

Ex-1.png

Ex-2.png
Title: Re: Teacher not available times - Button for swap X with empty
Post by: Liviu Lalescu on February 23, 2025, 04:52:34 PM
I will think about it, thank you! But colors might be different. For instance I use GNU/Linux and dark mode.
Title: Re: Teacher not available times - Button for swap X with empty
Post by: Volker Dirr on February 23, 2025, 06:27:53 PM
Can you also just write text? As a mathematician i suggest the symbol "for all": ∀
Title: Re: Teacher not available times - Button for swap X with empty
Post by: Liviu Lalescu on February 23, 2025, 06:33:34 PM
Nice! I will try.
Title: Re: Teacher not available times - Button for swap X with empty
Post by: Liviu Lalescu on February 24, 2025, 06:31:46 PM
I just released the new version with this. Thank you for the suggestions!
Title: Re: Teacher not available times - Button for swap X with empty
Post by: infoo_ on February 24, 2025, 07:06:48 PM
Thank you, @Liviu Lalescu you did an excellent work for 7.0.5!!

Maybe you can move further :) And see if the following can be implemented (with Qt I guess):

The possibility of dragging the mouse for multiple selection instead of single clicking on every adjacent slot of teacher not available times table (and possibly other tables with X and empty):

Feature-request-Drag-click-not-available-times.gif

It should also work in every direction (not only vertically)

(Sorry if the quality is bad, the max limit size is 512 kb :()
Title: Re: Teacher not available times - Button for swap X with empty
Post by: Liviu Lalescu on February 24, 2025, 07:14:50 PM
You are welcome, @infoo_ ! Thank you as well! :)

I will think of this, but now I am tired :)

@Volker Dirr , and other forum users, should we allow attachments with 1 MB or even more?
Title: Re: Teacher not available times - Button for swap X with empty
Post by: Volker Dirr on February 24, 2025, 07:29:33 PM
Quality is ok. (In fact that is also only 270 kb).
If you want to do the same just with a video, then it is quickly many MB large.
I fear a bit that too large attachments will flood your server too fast and other guys donate to less. You always need to pay the server. If you must pay for larger servers, then quickly all donations are used to pay the server only.
I thinks like this (videos) can be added as link to YouTube, Vimeo, google, dropbox and a lot of other resources.
Title: Re: Teacher not available times - Button for swap X with empty
Post by: Liviu Lalescu on February 24, 2025, 07:32:58 PM
OK, Volker! No changing.

Title: Re: Teacher not available times - Button for swap X with empty
Post by: infoo_ on February 24, 2025, 07:34:50 PM
In 2025, many videos are larger than past years. I think duplicating max limit will not impact in server capacity, since old videos remain the same, and the new attachments that can be long can be uploaded to YouTube which is always an option, as Volker said. The "grey area" are videos like this with few seconds.

I exported it as mp4 and when converted to gif (because we can't upload mp4 files) it was larger than mp4 ??? So I had to use an online compressor for producing ~256 kb video

It is my opinion
Title: Re: Teacher not available times - Button for swap X with empty
Post by: Liviu Lalescu on February 24, 2025, 07:37:34 PM
@Volker Dirr , should we allow mp4 extension? Is it safe?

@infoo_ , should we also consider allowing other extensions?
Title: Re: Teacher not available times - Button for swap X with empty
Post by: Volker Dirr on February 24, 2025, 07:51:03 PM
mp4 is a container that could include a lot of stuff (audio/video). So in fact a bit more unsafe than gif.
The size was only 256kb (mp4) vs 262kb (gif). I think in that case you don't need to allow mp4. In normal case most mp4 files are much larger (because normally mp4 files contains much longer audio/video) while gif are normally much smaller (since you normally don't do long video with it). So in my opinion it doesn't make much sense to allow mp4.
Title: Re: Teacher not available times - Button for swap X with empty
Post by: infoo_ on February 24, 2025, 07:51:31 PM
Quote from: Liviu Lalescu on February 24, 2025, 07:37:34 PM@infoo_ , should we also consider allowing other extensions?

This is as you wish. In other smf forums mp4's can't be uploaded, and others it can.

I don't see any security risk if other forums allow this, but if you have a particular reason not to allow it, keep blocking

Quote from: Volker Dirr on February 24, 2025, 07:51:03 PMThe size was only 256kb (mp4) vs 262kb (gif). I think in that case you don't need to allow mp4.

I think that most screen recorders do not allow exporting in gif format. That's why I think many users prefer mp4 because of its wide use and it is faster than using an additional tool
Title: Re: Teacher not available times - Button for swap X with empty
Post by: Volker Dirr on February 24, 2025, 09:19:00 PM
In my opinion the security is not the main problem, since it in fact as insecure as zip files. see https://www.heise.de/select/ct/2025/5/2502316093378550821
In my opinion the main problem is the size of videos. Not all videos will be as short as yours. They will be much longer and with audio also. There are too less guys donating. Liviu can't use all donations to pay the web server. FET is in fact his full time job and if you count the donations, subtract the money for server, ... then you will see that it is currently in fact very very bad paid job. No matter what other job he will do, even slaves are paid better, since they got at least a bad roof and some food for free.
Title: Re: Teacher not available times - Button for swap X with empty
Post by: infoo_ on February 24, 2025, 09:20:50 PM
Quote from: Volker Dirr on February 24, 2025, 09:19:00 PMThey will be much longer and with audio also. There are too less guys donating. Liviu can't use all donations to pay the web server. FET is in fact his full time job and if you count the donations, subtract the money for server, ... then you will see that it is currently in fact very very bad paid job. No matter what other job he will do, even slaves are paid better, since they got at least a bad roof and some food for free.

I agree
Title: Re: Teacher not available times - Button for swap X with empty
Post by: Liviu Lalescu on February 25, 2025, 07:40:38 AM
I added your suggestion in the TODO, but I think it is too difficult for me (dragging the X's).