Project

General

Profile

Bug #5353

Sessions: delay days do not influence sessions visualization for teachers in courses list

Added by Yannick Warnier almost 7 years ago. Updated almost 7 years ago.

Status:
Bug resolved
Priority:
Normal
Category:
Sessions
Target version:
Start date:
26/08/2012
Due date:
% Done:

100%

Estimated time:
Spent time:
Complexity:
Normal
SCRUM pts - complexity:
?

Description

In 1.9.2dev:
  • 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

sessionmanager.lib.php (75.2 KB) sessionmanager.lib.php Yoselyn Castillo, 06/09/2012 21:31
sessionmanager.lib.php (75.3 KB) sessionmanager.lib.php Yoselyn Castillo, 17/09/2012 16:30
usermanager.lib.php (157 KB) usermanager.lib.php Yoselyn Castillo, 24/09/2012 04:02
userportal.lib.php (50.4 KB) userportal.lib.php Yoselyn Castillo, 24/09/2012 04:02

Associated revisions

Revision ab480390 (diff)
Added by Julio Montoya almost 7 years ago

Fixing session date when entering to the portal as a coach see #5353

Revision fb16daaa (diff)
Added by Yoselyn Castillo almost 7 years ago

Should fix bug in session list see #5353

Revision a19f6b94 (diff)
Added by Yoselyn Castillo almost 7 years ago

fixing query see #5353

Revision b341bd76 (diff)
Added by Julio Montoya almost 7 years ago

Fixing session coach start/end date see #5353

Revision 7e843a28 (diff)
Added by Yoselyn Castillo almost 7 years ago

Session delay bug see #5353

Revision 604f4a54 (diff)
Added by Yoselyn Castillo almost 7 years ago

Fixing visualization of sessions for users - refs #5353

History

#1

Updated by Julio Montoya almost 7 years ago

bug confirmed

#2

Updated by Julio Montoya almost 7 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

#3

Updated by Yoselyn Castillo almost 7 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.

#4

Updated by Yoselyn Castillo almost 7 years ago

  • Assignee changed from Julio Montoya to Yoselyn Castillo
#5

Updated by Yoselyn Castillo almost 7 years ago

Upload this file. Fixed. Sessions shown if start_date-$today<= nb_days_access_before_beginning

#6

Updated by Julio Montoya almost 7 years ago

  • Status changed from Assigned to Needs testing
  • Assignee deleted (Julio Montoya)

file sent

#7

Updated by Yoselyn Castillo almost 7 years ago

  • Assignee set to Yoselyn Castillo
#8

Updated by Yoselyn Castillo almost 7 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?

#9

Updated by Yannick Warnier almost 7 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.

#10

Updated by Yoselyn Castillo almost 7 years ago

Thanks yannick, I didn't know anything about those urls for testing. I will check right now.

#11

Updated by Yoselyn Castillo almost 7 years ago

Upload the file again.

#12

Updated by Yoselyn Castillo almost 7 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.

#13

Updated by Julio Montoya almost 7 years ago

Are you sure this is right?

       (DATEDIFF(s.date_start,'".$today."' ".") <= s.nb_days_access_before_beginning) OR

file was sent

#14

Updated by Yannick Warnier almost 7 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 [ "."]

#15

Updated by Yoselyn Castillo almost 7 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.

#16

Updated by Yannick Warnier almost 7 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.

#17

Updated by Yoselyn Castillo almost 7 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...

#18

Updated by Julio Montoya almost 7 years ago

  • Status changed from Needs more info to Assigned
  • Assignee changed from Yannick Warnier to Julio Montoya

I will check that

#19

Updated by Julio Montoya almost 7 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

#20

Updated by Julio Montoya almost 7 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

#21

Updated by Yoselyn Castillo almost 7 years ago

Now i am testing

#22

Updated by Yoselyn Castillo almost 7 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.

#23

Updated by Julio Montoya almost 7 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

#24

Updated by Yoselyn Castillo almost 7 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.

#25

Updated by Julio Montoya almost 7 years ago

any news?

#26

Updated by Yoselyn Castillo almost 7 years ago

Yes, it shows sessions even if they are finished. So i have done a fix, please upload these files.

#27

Updated by Julio Montoya almost 7 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

#28

Updated by Yoselyn Castillo almost 7 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.

#29

Updated by Yannick Warnier almost 7 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?

#30

Updated by Yoselyn Castillo almost 7 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.

#31

Updated by Yannick Warnier almost 7 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?)

Also available in: Atom PDF