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:
Rufus Pollock 2012-06-06 10:21:56 -07:00
commit 5dbc086c06

View File

@ -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};
})