* added new sangria report: dup members
This commit is contained in:
Sebastian Marcet 2014-11-28 16:59:10 -03:00
parent 3cbebb31d1
commit babbff54e2
2 changed files with 41 additions and 2 deletions

View File

@ -29,6 +29,7 @@ final class SangriaPageExportDataExtension extends Extension
'ExportAppDevSurveyResults', 'ExportAppDevSurveyResults',
'exportFoundationMembers', 'exportFoundationMembers',
'exportCorporateSponsors', 'exportCorporateSponsors',
'exportDupUsers',
)); ));
@ -40,6 +41,7 @@ final class SangriaPageExportDataExtension extends Extension
'ExportAppDevSurveyResults', 'ExportAppDevSurveyResults',
'exportFoundationMembers', 'exportFoundationMembers',
'exportCorporateSponsors', 'exportCorporateSponsors',
'exportDupUsers',
)); ));
} }
@ -248,7 +250,6 @@ SQL;
$filename = "survey_results" . $fileDate . ".csv"; $filename = "survey_results" . $fileDate . ".csv";
return CSVExporter::getInstance()->export($filename, $data, ','); return CSVExporter::getInstance()->export($filename, $data, ',');
} }
// Export CSV of all App Dev Surveys // Export CSV of all App Dev Surveys
@ -416,4 +417,37 @@ SQL;
return CSVExporter::getInstance()->export($filename, $data); return CSVExporter::getInstance()->export($filename, $data);
} }
public function exportDupUsers(){
$fileDate = date('Ymdhis');
SangriaPage_Controller::generateDateFilters('s');
$sql = <<< SQL
select FirstName, Surname, count(FirstName) AS Qty , group_concat(Email SEPARATOR '|') AS Emails,group_concat(ID SEPARATOR '|') AS MemberIds
from Member
group by FirstName, Surname
having count(FirstName) > 1
order by FirstName, Surname;
SQL;
$res = DB::query($sql);
$fields = array('FirstName','Surname','Qty','Emails','MemberIds');
$data = array();
foreach ($res as $row) {
$member = array();
foreach ($fields as $field) {
$member[$field] = $row[$field];
}
array_push($data, $member);
}
$filename = "dup_users_report" . $fileDate . ".csv";
return CSVExporter::getInstance()->export($filename, $data, ',');
}
} }

View File

@ -68,7 +68,12 @@
<button style="padding: 5px" id="btn4_xls">Export Gerrit Users (XLS)</button> <button style="padding: 5px" id="btn4_xls">Export Gerrit Users (XLS)</button>
<button style="padding: 5px" id="btn4_csv">Export Gerrit Users (CSV)</button> <button style="padding: 5px" id="btn4_csv">Export Gerrit Users (CSV)</button>
</form> </form>
<br/>
<br/>
<h2>Duplicate Users Report</h2>
<form method="get" id="form-export-dup-users-data" name="form-export-dup-users-data" action="$Link(exportDupUsers)">
<button style="padding: 5px" id="btn5_csv">GET</button>
</form>