Merge pull request #146 from icmurray/master
[backend/dataproxy,bugfix][s]: Fix to dataproxy backend to allow viewing files with duplicate column title names from @icmurray.
This commit is contained in:
commit
5dbc086c06
@ -56,6 +56,19 @@ this.recline.Backend.DataProxy = this.recline.Backend.DataProxy || {};
|
||||
if (results.error) {
|
||||
dfd.reject(results.error);
|
||||
}
|
||||
|
||||
// Rename duplicate fieldIds as each field name needs to be
|
||||
// unique.
|
||||
var seen = {};
|
||||
_.map(results.fields, function(fieldId, index) {
|
||||
if (fieldId in seen) {
|
||||
seen[fieldId] += 1;
|
||||
results.fields[index] = fieldId + "("+seen[fieldId]+")";
|
||||
} else {
|
||||
seen[fieldId] = 1;
|
||||
}
|
||||
});
|
||||
|
||||
dataset.fields.reset(_.map(results.fields, function(fieldId) {
|
||||
return {id: fieldId};
|
||||
})
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user