From d510448277ae325f5de5cd3b9bc23b201ed6b1e5 Mon Sep 17 00:00:00 2001 From: Dennis Eriksen Date: Fri, 24 May 2013 22:06:12 +0200 Subject: added overview and example of dividing. --- views/project.ejs | 42 +++++++++++++++++++++++++++++++++++++----- 1 file changed, 37 insertions(+), 5 deletions(-) (limited to 'views/project.ejs') diff --git a/views/project.ejs b/views/project.ejs index d78d11c..dedd5e4 100644 --- a/views/project.ejs +++ b/views/project.ejs @@ -53,7 +53,7 @@ -
+
@@ -69,12 +69,44 @@
-
-

Her vises hvor mye andre skylder deg totalt, hvor mye du skylder andre totalt, og differansen mellom disse to tallene

-
- +
+

Det er til sammen brukt <%= (pro.total).toFixed(2) %> <%= project.currency %>. Deltakerne skal altså betale <%= (pro.each).toFixed(2) %> <%= project.currency %> hver.

+ <% for (var i in pro.user) { %> + <%- pro.user[i].name %> har betalt <%= pro.user[i].total %> <%= project.currency %>, og <%- pro.user[i].diff >= 0 ? 'skyldes ' + pro.user[i].diff : 'skylder ' + Math.abs(pro.user[i].diff) %> <%= project.currency %>
+ <% } %> +

Eksempel på hvordan oppgjøret kan gjøres

+
+
+ + <% + // FUGLY LAST-MINUTE CODE + var i = 1; + for (var u in pro.user) { + if (pro.user[u].coeff === 0) { + if (i === 1) {%> + + + <% for (var p in pro.user) { %> + <%- pro.user[p].coeff > 0 ? '' : '' %> + <% } %> + + <% } %> + + + <% for (var p in pro.user) { %> + <%- pro.user[p].coeff > 0 ? '' : '' %> + <% } %> + +<% i++; + }} %> +
' + pro.user[p].name + '
<%- pro.user[u].name %>' + (Math.abs(pro.user[u].diff) * pro.user[p].coeff).toFixed(2) + '
+ +
+
+ +
-- cgit v1.2.3