[guadec-web-regcfp/develop] fixes
- From: Patrick Uiterwijk <puiterwijk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [guadec-web-regcfp/develop] fixes
- Date: Fri, 19 Jun 2015 12:22:09 +0000 (UTC)
commit 69ca75959f014691bcb321b487eabd4b056ee1a1
Author: Patrick Uiterwijk <puiterwijk redhat com>
Date: Fri Jun 19 14:21:54 2015 +0200
fixes
models/registration.js | 14 ++++++++++++--
routes/registration.js | 8 ++++----
views/index/index.hbs | 2 +-
3 files changed, 17 insertions(+), 7 deletions(-)
---
diff --git a/models/registration.js b/models/registration.js
index c6995bf..92dafb3 100644
--- a/models/registration.js
+++ b/models/registration.js
@@ -28,11 +28,21 @@ module.exports = function(sequelize, DataTypes) {
}
return amount;
},
- outstanding: function() {
+ outstanding_onsite: function() {
var amount = 0;
for(var payment in this.RegistrationPayments) {
payment = this.RegistrationPayments[payment];
- if(!payment.paid) {
+ if(!payment.paid && payment.method == 'onsite') {
+ amount += payment.amount;
+ }
+ }
+ return amount;
+ },
+ outstanding_paypal: function() {
+ var amount = 0;
+ for(var payment in this.RegistrationPayments) {
+ payment = this.RegistrationPayments[payment];
+ if(!payment.paid && payment.method == 'paypal') {
amount += payment.amount;
}
}
diff --git a/routes/registration.js b/routes/registration.js
index e830c0a..c7e66ef 100644
--- a/routes/registration.js
+++ b/routes/registration.js
@@ -218,16 +218,16 @@ router.post('/register', function(req, res, next) {
res.status(500).send('Error saving user');
} else {
req.user = user;
- handle_registration();
+ handle_registration(req, res, next);
};
});
}
} else {
- return handle_registration();
+ return handle_registration(req, res, next);
}
});
-function handle_registration() {
+function handle_registration(req, res, next) {
req.user.getRegistration({include: [RegistrationPayment]})
.complete(function(err, reg) {
var reg_info = {
@@ -239,7 +239,7 @@ function handle_registration() {
UserId: req.user.Id
};
var regfee = req.body.regfee;
- reg_info.UserId = req.User.Id;
+ reg_info.UserId = req.user.Id;
if((reg == null && regfee == null)) {
res.render('registration/register', { registration: reg_info,
diff --git a/views/index/index.hbs b/views/index/index.hbs
index f2389e5..24fc5ee 100644
--- a/views/index/index.hbs
+++ b/views/index/index.hbs
@@ -39,7 +39,7 @@ Hello, please login, or choose an option below.
{{#ifGTE registration.paid config.registration.min_amount_for_receipt}}
<div class="button"><a href="/registration/receipt">Get receipt</a></div>
{{else}}
-Not enough paid for receipt (Paid {{config.registration.currency_symbol}}{{registration.paid}}, outstanding
for onsite payment: {{config.registration.currency_symbol}}{{registration.outstanding}}, PayPal outstanding:
{{config.registration.currency_symbol}}{{registration.paypal_outstanding}})<br/>
+Not enough paid for receipt (Paid {{config.registration.currency_symbol}}{{registration.paid}}, outstanding
for onsite payment: {{config.registration.currency_symbol}}{{registration.outstanding_onsite}}, PayPal
outstanding: {{config.registration.currency_symbol}}{{registration.outstanding_paypal}})<br/>
{{/ifGTE}}
{{#has_permission "registration/pay_extra"}}
<div class="button"><a href="/registration/pay">Pay more</a></div>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]