Skip to content
This repository has been archived by the owner on Feb 22, 2024. It is now read-only.

Commit

Permalink
#3 experimental functionality (3)
Browse files Browse the repository at this point in the history
  • Loading branch information
steffchep committed Feb 16, 2018
1 parent e940021 commit d2946cd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/main/webapp/js/store/talks.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ define(['store', 'computed', 'request', 'popups', 'dataHelper', 'scrollHelper'],
return false;
}
console.log (occupied + "/" + available + "=" + (occupied / available));
console.log ("true or false? " + (occupied / available >= threshold));
return occupied / available >= threshold;
}

Expand Down Expand Up @@ -81,7 +82,6 @@ define(['store', 'computed', 'request', 'popups', 'dataHelper', 'scrollHelper'],

function confirmAndToggleFull(event) {
var id = event.currentTarget.getAttribute("data-id");
console.log("id=" + id);
var theTalk = computed.talks()[id];
if (!store.loggedIn) {
popups.alert("Please Log In", "You must be logged in to do this.");
Expand All @@ -91,7 +91,9 @@ define(['store', 'computed', 'request', 'popups', 'dataHelper', 'scrollHelper'],
return;
}

confirmAndUpdate(theTalk, (theTalk.fullyBooked ? theTalk.availableSeats : 0));
var newValueForSeats = theTalk.fullyBooked ? theTalk.availableSeats : 0;
document.querySelector("input[data-id='" + id +"']").value = newValueForSeats;
confirmAndUpdate(theTalk, newValueForSeats);
}

function loadTalks() {
Expand Down
1 change: 1 addition & 0 deletions src/main/webapp/js/utils/request.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ define(['dataHelper'], function (helper) {
if (headers) {
var key, headerKeys = Object.keys(headers);
for (key in headerKeys) {
console.log("set request header " + headerKeys[key] + " to " + headers[headerKeys[key]]);
xhttp.setRequestHeader(headerKeys[key], headers[headerKeys[key]]);
}
}
Expand Down

0 comments on commit d2946cd

Please sign in to comment.