You are viewing a plain text version of this content. The canonical link for it is here.
Posted to olio-commits@incubator.apache.org by sh...@apache.org on 2009/02/12 18:29:59 UTC

svn commit: r743827 - in /incubator/olio/webapp/php/trunk/public_html: addAttendee.php events.php

Author: shanti
Date: Thu Feb 12 18:29:58 2009
New Revision: 743827

URL: http://svn.apache.org/viewvc?rev=743827&view=rev
Log:
Fix for OLIO-52. The issue was that as attendees keep getting added during the run, trying
to retrieve all of them causes more and more rows to be retrieved. The current fix simply
limits the attendee retrievals to 20. Longer term, we need to add a paging mechanism.

Modified:
    incubator/olio/webapp/php/trunk/public_html/addAttendee.php
    incubator/olio/webapp/php/trunk/public_html/events.php

Modified: incubator/olio/webapp/php/trunk/public_html/addAttendee.php
URL: http://svn.apache.org/viewvc/incubator/olio/webapp/php/trunk/public_html/addAttendee.php?rev=743827&r1=743826&r2=743827&view=diff
==============================================================================
--- incubator/olio/webapp/php/trunk/public_html/addAttendee.php (original)
+++ incubator/olio/webapp/php/trunk/public_html/addAttendee.php Thu Feb 12 18:29:58 2009
@@ -43,7 +43,10 @@
 if (!isset($connection)) { // If connection not there, we're read-only.
     $connection = DBConnection::getInstance();
 }
-$listquery = "select username from PERSON_SOCIALEVENT where socialeventid = '$se'";
+$listquery = "select username from PERSON_SOCIALEVENT ".
+             "where socialeventid = '$se' and username = '$username' ".
+             "union select username from PERSON_SOCIALEVENT ".
+             "where socialeventid = '$se' limit 20";
 $listqueryresult = $connection->query($listquery);
 $username = $_SESSION["uname"];
 while($listqueryresult->next()) {

Modified: incubator/olio/webapp/php/trunk/public_html/events.php
URL: http://svn.apache.org/viewvc/incubator/olio/webapp/php/trunk/public_html/events.php?rev=743827&r1=743826&r2=743827&view=diff
==============================================================================
--- incubator/olio/webapp/php/trunk/public_html/events.php (original)
+++ incubator/olio/webapp/php/trunk/public_html/events.php Thu Feb 12 18:29:58 2009
@@ -76,11 +76,21 @@
                          $result->get(13).",".$result->get(14);
         }
 unset($result);
-$listquery = "select username from PERSON_SOCIALEVENT where socialeventid = '$se'";
+if (isset($_SESSION["uname"])) {
+    // Ensure our user name comes in first, if already attending.
+    $listquery = "select username from PERSON_SOCIALEVENT ".
+                 "where socialeventid = '$se' and username = '$username' ".
+                 "union select username from PERSON_SOCIALEVENT ".
+                 "where socialeventid = '$se' limit 20";
+
+} else {
+    $listquery = "select username from PERSON_SOCIALEVENT ".
+                 "where socialeventid = '$se' limit 20";
+}
 $listqueryresult = $connection->query($listquery);
 while($listqueryresult->next()) {
         $tmp_uname = $listqueryresult->get(1);
-        if (!is_null($_SESSION["uname"]) && $tmp_uname == $username) {
+        if (!isset($_SESSION["uname"]) && $tmp_uname == $username) {
                 $unattend = true; // show unattend button if user is already registered.
         }
         $attendeeList = $attendeeList." ".'<a href="users.php?username='.$tmp_uname.'">'.$tmp_uname.'</a><br />';



Limiting #attendees retrieved

Posted by Shanti Subramanyam - PAE <Sh...@Sun.COM>.
Will,
  Can you please check the rails code to see if this issue can bite 
there as well ? I suspect it will, unless you're somehow limiting the 
#attendees retrieved.

Shanti

On 02/12/09 10:29 AM, shanti@apache.org wrote:
> Author: shanti
> Date: Thu Feb 12 18:29:58 2009
> New Revision: 743827
> 
> URL: http://svn.apache.org/viewvc?rev=743827&view=rev
> Log:
> Fix for OLIO-52. The issue was that as attendees keep getting added during the run, trying
> to retrieve all of them causes more and more rows to be retrieved. The current fix simply
> limits the attendee retrievals to 20. Longer term, we need to add a paging mechanism.
> 
> Modified:
>     incubator/olio/webapp/php/trunk/public_html/addAttendee.php
>     incubator/olio/webapp/php/trunk/public_html/events.php
> 
> Modified: incubator/olio/webapp/php/trunk/public_html/addAttendee.php
> URL: http://svn.apache.org/viewvc/incubator/olio/webapp/php/trunk/public_html/addAttendee.php?rev=743827&r1=743826&r2=743827&view=diff
> ==============================================================================
> --- incubator/olio/webapp/php/trunk/public_html/addAttendee.php (original)
> +++ incubator/olio/webapp/php/trunk/public_html/addAttendee.php Thu Feb 12 18:29:58 2009
> @@ -43,7 +43,10 @@
>  if (!isset($connection)) { // If connection not there, we're read-only.
>      $connection = DBConnection::getInstance();
>  }
> -$listquery = "select username from PERSON_SOCIALEVENT where socialeventid = '$se'";
> +$listquery = "select username from PERSON_SOCIALEVENT ".
> +             "where socialeventid = '$se' and username = '$username' ".
> +             "union select username from PERSON_SOCIALEVENT ".
> +             "where socialeventid = '$se' limit 20";
>  $listqueryresult = $connection->query($listquery);
>  $username = $_SESSION["uname"];
>  while($listqueryresult->next()) {
> 
> Modified: incubator/olio/webapp/php/trunk/public_html/events.php
> URL: http://svn.apache.org/viewvc/incubator/olio/webapp/php/trunk/public_html/events.php?rev=743827&r1=743826&r2=743827&view=diff
> ==============================================================================
> --- incubator/olio/webapp/php/trunk/public_html/events.php (original)
> +++ incubator/olio/webapp/php/trunk/public_html/events.php Thu Feb 12 18:29:58 2009
> @@ -76,11 +76,21 @@
>                           $result->get(13).",".$result->get(14);
>          }
>  unset($result);
> -$listquery = "select username from PERSON_SOCIALEVENT where socialeventid = '$se'";
> +if (isset($_SESSION["uname"])) {
> +    // Ensure our user name comes in first, if already attending.
> +    $listquery = "select username from PERSON_SOCIALEVENT ".
> +                 "where socialeventid = '$se' and username = '$username' ".
> +                 "union select username from PERSON_SOCIALEVENT ".
> +                 "where socialeventid = '$se' limit 20";
> +
> +} else {
> +    $listquery = "select username from PERSON_SOCIALEVENT ".
> +                 "where socialeventid = '$se' limit 20";
> +}
>  $listqueryresult = $connection->query($listquery);
>  while($listqueryresult->next()) {
>          $tmp_uname = $listqueryresult->get(1);
> -        if (!is_null($_SESSION["uname"]) && $tmp_uname == $username) {
> +        if (!isset($_SESSION["uname"]) && $tmp_uname == $username) {
>                  $unattend = true; // show unattend button if user is already registered.
>          }
>          $attendeeList = $attendeeList." ".'<a href="users.php?username='.$tmp_uname.'">'.$tmp_uname.'</a><br />';
> 
>