forked from cargografias/cargografias
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathduplicados.html
More file actions
117 lines (91 loc) · 3.15 KB
/
duplicados.html
File metadata and controls
117 lines (91 loc) · 3.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
<div id="result">
</div>
<script type="text/template" id="person">
<h1>
<a target="_blank" href="https://<%=instance%>/persons/<%=person.id%>"> <%=person.name%> </a>
<a target="_blank" href="http://www.cargografias.org/<%=instance%>#/memberships-<%=person.id_sha1.substr(0,6)%>"> <%=person.id_sha1.substr(0,6)%> </a>
</h1>
<% repes.forEach(function(r){ %>
<h2>Repetidos mismo anio</h2>
<table border=1>
<tr>
<td></td>
<td>start</td>
<td>end</td>
<td>label</td>
<td>organization</td>
</tr>
<% r.forEach(function(m){ %>
<tr>
<td>
<a target="_blank" href="https://<%=instance%>/memberships/<%=m.id%>">popit</a>
</td>
<td><%=m.start_date%></td>
<td><%=m.end_date%></td>
<td><%=m.label%></td>
<td>
<a target="_blank" href="https://<%=instance%>/organizations/<%=m.organization_id%>"><%=orgid[m.organization_id].name%></a>
</td>
</tr>
<% }) %>
</table>
<% }) %>
</script>
<script src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.8.3/underscore-min.js"></script>
<script>
var instance = 'cargografias';
try{
instance = window.location.href.split('?')[1]
}catch(ex){}
var personTemplate = _.template($('#person').html());
jQuery.getJSON( "http://localhost:8080/static-public/datasets/" + instance + "-memberships.json" , function(res){
mem = res
console.log('mem')
} )
jQuery.getJSON( "http://localhost:8080/static-public/datasets/" + instance + "-organizations.json" , function(res){
console.log('oprg')
org = res
orgid = org.reduce(function(memo, o){ memo[o.id] = o; return memo;}, {})
} )
jQuery.getJSON( "http://localhost:8080/static-public/datasets/" + instance + "-persons.json" , function(res){
console.log('per')
per = res
filterPersons()
} )
function filterPersons(){
var renderedparts = [];
filtered = per.filter(function(p) {
var aa = {}
p.memberships.forEach(function(m){
if(m.start_date){
var sdd = m.start_date.substr(0,4)
aa[sdd] = aa[sdd] || []
aa[sdd].push(m);
}
})
var repes = []
for(x in aa){
if(aa[x].length > 1){
repes.push(aa[x])
}
}
if(repes.length){
renderedparts.push(personTemplate({
person: p,
repes: repes,
orgid: orgid,
instance: instance
}))
console.log(" PERSON " , p.name)
repes.forEach(function(r){
console.log('Repes =============== (mismo anio)')
r.forEach(function(m){
console.log(m)
})
})
}
})
$('#result').html(renderedparts.join(' '));
}
</script>