Bug #5353
Sessions: delay days do not influence sessions visualization for teachers in courses list
Description
- Define a session to start in 2 days.
- Assign a known user as general coach for this session
- Put "5" in "Days before" so this coach can access the session prior to the session start date
- Add a course to the session
- Save the session
- Connect as the general coach
- In the courses list, the session doesn't appear (it should, as the coach should be able to see it 5 days before the official start in two days)
Files
Associated revisions
Should fix bug in session list see #5353
fixing query see #5353
Fixing session coach start/end date see #5353
Session delay bug see #5353
Fixing visualization of sessions for users - refs #5353
History
Updated by Julio Montoya over 9 years ago
- Status changed from Assigned to Needs testing
- Assignee changed from Julio Montoya to Yoselyn Castillo
- % Done changed from 0 to 50
should be fixed now
Updated by Yoselyn Castillo over 9 years ago
- Status changed from Needs testing to Assigned
- Assignee changed from Yoselyn Castillo to Julio Montoya
Bug confirmed. It continues not working for me. I defined a session to start in 2 days.
I assigned a known user as general coach for this session. I putted "5" in "Days before" and in the list the session does't appear for tha user. tested in my local pc. I will try in chamilodev.
Updated by Yoselyn Castillo over 9 years ago
- Assignee changed from Julio Montoya to Yoselyn Castillo
Updated by Yoselyn Castillo over 9 years ago
- File sessionmanager.lib.php sessionmanager.lib.php added
- Assignee changed from Yoselyn Castillo to Julio Montoya
- % Done changed from 50 to 80
Upload this file. Fixed. Sessions shown if start_date-$today<= nb_days_access_before_beginning
Updated by Julio Montoya over 9 years ago
- Status changed from Assigned to Needs testing
- Assignee deleted (
Julio Montoya)
file sent
Updated by Yoselyn Castillo over 9 years ago
- Assignee changed from Yoselyn Castillo to Julio Montoya
It works perfectly in my local pc, but in chamilodev it shows always the session (Although if start_date-$today> nb_days_access_before_beginning) just changing the icon active or inactive. Is chamilodev updated? What do you think is hapenning?
Updated by Yannick Warnier over 9 years ago
- Assignee changed from Julio Montoya to Yoselyn Castillo
Hello Yoselyn,
I think I sent you an e-mail, didn't I? From now on, we are testing on http://stable.chamilo.org for 1.9.2 and on http://unstable.chamilo.org for 1.10.
I think chamilodev is still updated automatically, but it shouldn't be used anymore, anyway.
I'm assigning it to you again so you can verify on http://stable.chamilo.org (just do the same check as you did here). If it works for you, you can close it.
Updated by Yoselyn Castillo over 9 years ago
Thanks yannick, I didn't know anything about those urls for testing. I will check right now.
Updated by Yoselyn Castillo over 9 years ago
- File sessionmanager.lib.php sessionmanager.lib.php added
- Status changed from Needs testing to Assigned
- Assignee changed from Yoselyn Castillo to Julio Montoya
Upload the file again.
Updated by Yoselyn Castillo over 9 years ago
- Assignee changed from Julio Montoya to Yoselyn Castillo
It is fixed now. Sessions are shown Active or inactive it depends on the start date and days before beginnig,but there is a little problem, when i click the session_list.php for first time it shows all sessions, though status combo box is in ACTIVE. if i change the status it shows the correct sessions.
Updated by Julio Montoya over 9 years ago
Are you sure this is right?
(DATEDIFF(s.date_start,'".$today."' ".") <= s.nb_days_access_before_beginning) OR
file was sent
Updated by Yannick Warnier over 9 years ago
- % Done changed from 80 to 70
I would highly prefer the DATEDIFF calculation to be done in PHP. The problem with this syntax is, although it will work well faster for a few registers, it makes it impossible for MySQL to use an index on the nb_days_access_before_beginning, because the comparison value is calculated dynamically.
nb_days_access_before_beginning
It would be much better to have the date calculation happen in PHP, then pass a fixed value to MySQL to compare with nb_days_accss_before_beginning. Nice catch, Julio.
Also, take extra caution about the timezones management and the... apparently unnecessary [ "."]
Updated by Yoselyn Castillo over 9 years ago
Well, if you want i will change the comparison and i will verify the problem with the status in session_list.php too.
Updated by Yannick Warnier over 9 years ago
Yoselyn Castillo wrote:
Well, if you want i will change the comparison and i will verify the problem with the status in session_list.php too.
Yes, please do.
Updated by Yoselyn Castillo over 9 years ago
- Status changed from Assigned to Needs more info
- Assignee changed from Yoselyn Castillo to Yannick Warnier
From the way in which is implemented the query, it is very difficult to change the comparison to php. I have developed a function in php, for obtaining the difference between 1 date(passed as parameter) and $today, but i can't invoke the function from mysql passing the parameter(in this case date_start) to be compared the result with nb_days_access_before_beginning.
So i decided to make the comparison in foreach after recovering all data from the query, but the problem is that there are sessions which doesn't appear in any status.
Julio and me have thought it would be useful to have a field "active" in table session in database. Please if you have another alternative...
Updated by Julio Montoya over 9 years ago
- Status changed from Needs more info to Assigned
- Assignee changed from Yannick Warnier to Julio Montoya
I will check that
Updated by Julio Montoya over 9 years ago
Undo latest changes.
I think the bug was in the "sessions visualization for teachers in courses list"
I found some errors I still working on it
Updated by Julio Montoya over 9 years ago
- Status changed from Assigned to Needs testing
- Assignee changed from Julio Montoya to Yoselyn Castillo
- % Done changed from 70 to 80
now it should work
Updated by Yoselyn Castillo over 9 years ago
- Status changed from Needs testing to Needs more info
- Assignee changed from Yoselyn Castillo to Julio Montoya
Ok, it shows in course list, sessions active and sessions in which date_start-$today <= nb_days_access_before_beginning.
But i have a question: sessions that have already ended should be shown too? If it is like this, you can close the task.
Updated by Julio Montoya over 9 years ago
- Assignee changed from Julio Montoya to Yoselyn Castillo
Only when "date_start-$today <= nb_days_access_before_beginnin"g and the other condition with "nb_days_access_after_end" for coaches
Updated by Yoselyn Castillo over 9 years ago
- Status changed from Needs more info to Needs testing
ok verifying... because i think in the course list, sessions that have finished their date_end are shown too.
Updated by Yoselyn Castillo over 9 years ago
- File usermanager.lib.php usermanager.lib.php added
- File userportal.lib.php userportal.lib.php added
- Status changed from Needs testing to Assigned
- Assignee changed from Yoselyn Castillo to Julio Montoya
Yes, it shows sessions even if they are finished. So i have done a fix, please upload these files.
Updated by Julio Montoya over 9 years ago
- Assignee changed from Julio Montoya to Yoselyn Castillo
I sent the usermanager.lib.php file, I think the code you added in userportal.lib.php exists already in api_get_session_visibility() in main_api.lib.php
Updated by Yoselyn Castillo over 9 years ago
- Status changed from Assigned to Needs more info
- Assignee changed from Yoselyn Castillo to Julio Montoya
I have tested with function api_get_session_visibility, but it doesn't work. It continues showing ended sessions. The code in userportal.lib.php works fine.
Updated by Yannick Warnier over 9 years ago
- Assignee changed from Julio Montoya to Yoselyn Castillo
The only difference I can see is in the usermanager.lib.php file. Is that all? Where is the user_portal.php change we're talking about here?
Updated by Yoselyn Castillo over 9 years ago
The change is in the way of visualization of sessions which have ended. It is in userportal.lib.php file that i attached in my last messages, but it is not in server.
Updated by Yannick Warnier over 9 years ago
- Status changed from Needs more info to Bug resolved
- % Done changed from 80 to 100
Aplicé tu parche. Cambié un poco la ubicación del *24*3600, para que el nombre de la variable sea más lógico
Con esto, asumo que estamos bien. Lo que no esté bien será para la próxima versión (dentro de un mes?)
Fixing session date when entering to the portal as a coach see #5353