You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by na...@apache.org on 2010/01/07 04:09:48 UTC

svn commit: r896745 - /tuscany/sandbox/travelsample/contributions/fullapp-ui/src/main/resources/scatours.html

Author: nash
Date: Thu Jan  7 03:09:42 2010
New Revision: 896745

URL: http://svn.apache.org/viewvc?rev=896745&view=rev
Log:
Fix incorrect logic to display currency for items in cart (TUSCANY-3411)

Modified:
    tuscany/sandbox/travelsample/contributions/fullapp-ui/src/main/resources/scatours.html

Modified: tuscany/sandbox/travelsample/contributions/fullapp-ui/src/main/resources/scatours.html
URL: http://svn.apache.org/viewvc/tuscany/sandbox/travelsample/contributions/fullapp-ui/src/main/resources/scatours.html?rev=896745&r1=896744&r2=896745&view=diff
==============================================================================
--- tuscany/sandbox/travelsample/contributions/fullapp-ui/src/main/resources/scatours.html (original)
+++ tuscany/sandbox/travelsample/contributions/fullapp-ui/src/main/resources/scatours.html Thu Jan  7 03:09:42 2010
@@ -277,6 +277,7 @@
         }
         var itemsHTML = '';
         var totalPrice  = 0.0;
+        var currency = '?';
 
         for (var x=0; x<trips.length; x++){
             itemsHTML += '<h3>Trip - ' + trips[x].id + '</h3>';
@@ -294,6 +295,9 @@
                 itemsHTML += '<td>' +  trips[x].fromDate + ' - ' + trips[x].toDate +'</td>';
                 itemsHTML += '<td>' +  trips[x].price + ' ' + trips[x].currency + '</td>';
                 itemsHTML += '</tr>';
+                if (totalPrice == 0.0) {
+                    currency = trips[x].currency;
+                }
                 totalPrice = totalPrice + trips[x].price;
 
             } else {
@@ -308,6 +312,9 @@
                     itemsHTML += '<td>' +  tripItems[i].fromDate + ' - ' + tripItems[i].toDate +'</td>';
                     itemsHTML += '<td>' +  tripItems[i].price + ' ' + tripItems[i].currency + '</td>';
                     itemsHTML += '</tr>';
+                    if (totalPrice == 0.0) {
+                        currency = tripItems[i].currency;
+                    }
                     totalPrice = totalPrice + tripItems[i].price;
                 }
             }
@@ -316,7 +323,7 @@
         }
 
         document.getElementById('cartItems').innerHTML = itemsHTML;
-        document.getElementById('cartPrice').innerHTML = totalPrice + ' ' + trips[0].currency;
+        document.getElementById('cartPrice').innerHTML = totalPrice + ' ' + currency;
     }
 
     function checkout() {