Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Score booster added + log

  • Loading branch information...
commit 592a50ff8be54d443448d521a2cca21f9e275a8d 1 parent e2752d7
@cedricss authored
Showing with 12 additions and 2 deletions.
  1. +12 −2 src/main.opa
View
14 src/main.opa
@@ -10,12 +10,20 @@ type result = {
string candidate_name,
string candidate_first_name,
int score,
+ list(Date.date) log
}
database presidential @mongo {
result /first[{id}]
}
+function increase(result) {
+ /presidential/first[id == result.id] <- { score += 800, log <+ Date.now() };
+ arr = result.arrondissement;
+ #{"a{arr}"} = tab_pan(arr);
+}
+
+
function table(arr) {
dbset(result, _) s = /presidential/first[arrondissement == arr; order -score; limit 50];
it = DbSet.iterator(s);
@@ -32,9 +40,11 @@ function table_row(result) {
<td>{ result.candidate_name }</td>
<td>{ result.score }</td>
<td>
- <a href="#" class="btn btn-mini"></a>
+ <a onclick={ function(_) { increase(result) } } href="#" class="btn btn-mini">
+ Booster
+ </a>
</td>
- <td></td>
+ <td>{ List.length(result.log) }</td>
</tr>
}

0 comments on commit 592a50f

Please sign in to comment.
Something went wrong with that request. Please try again.