Improve reports#73
Conversation
Introduce a missing-photo report (API + XLSX export) and support for tagpicker (title/department/country) and scope (orgChart/all) filters across reports and the user scanner. Key changes: add MISSING_PHOTO_FILE config, msgraph.batch_check_photos to detect users with profile photos, data_update now builds missing_photo_records.json and collects recently-hired from all users, reports module gains load/apply helpers (apply_missing_photo_filters, apply_tagpicker_filters) and new load_missing_photo_data. app_main: new endpoints for missing-photo, unified parsing helpers (_parse_tagpicker_args, _parse_standard_toggle_args, _apply_scope_filter), and propagate scope/tagpicker handling to many report endpoints and the full user scanner. UI: update i18n strings, add tagpicker/scope UI and CSS rules, refactor reports.js filter construction and change default report. Also include country in record payloads and table columns where applicable.
There was a problem hiding this comment.
Pull request overview
This PR expands the admin reports area with missing-photo reporting, broader scope/tag filtering, and related backend/frontend support for country metadata and scanner filtering.
Changes:
- Adds missing-photo cache generation, API/report/export support, and UI/report configuration.
- Introduces reusable scope, toggle, and tagpicker filters across reports and scanner full scans.
- Updates metadata, localization, styling, and Graph data collection to support country/photo filtering.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
templates/reports.html |
Updates report selector options, filter toolbar placement, and scanner tab defaults. |
static/reports.js |
Adds missing-photo config, shared filter definitions, tagpicker UI, retry handling, and scanner filter integration. |
static/reports.css |
Styles new tagpicker filter rows and adjusts scanner/report spacing. |
static/locales/en-US.json |
Adds/updates report labels, missing-photo strings, scope/tagpicker labels, and country column text. |
simple_org_chart/reports.py |
Adds missing-photo cache loading and tagpicker/missing-photo filter helpers. |
simple_org_chart/msgraph.py |
Adds country to login records and introduces Graph batch photo checking. |
simple_org_chart/hierarchy.py |
Carries country into flattened hierarchy records. |
simple_org_chart/data_update.py |
Generates missing-photo and all-user recently-hired caches during data sync. |
simple_org_chart/config.py |
Adds the missing-photo cache file path. |
simple_org_chart/app_main.py |
Adds missing-photo endpoints, metadata countries, scope/tagpicker parsing, and applies filters across reports/scanner APIs. |
Comments suppressed due to low confidence (2)
simple_org_chart/app_main.py:2477
- The export path has the same default-scope mismatch as the JSON endpoint: without an explicit
scope=all,_apply_scope_filterremoves filtered users that are not in the org-chart employee cache, so direct export links/API calls can produce an incomplete workbook. Useallas the default here to keep the filtered-users report/export consistent.
scope = request.args.get('scope', 'orgChart')
static/reports.js:1958
- The full-scan request body uses the same comma-delimited serialization for tagpicker values, so a selected title/department/country containing a comma is split into multiple filters by the backend and the scan population is filtered incorrectly. Send the selected values as arrays (or otherwise encode them losslessly) and parse that shape on the server.
base[paramName] = tagVal.values.join(',');
base[filter.modeQueryParam] = tagVal.mode || 'exclude';
|
@copilot apply changes based on the comments in this thread |
Agent-Logs-Url: https://github.com/dvir001/Simple-Org-Chart/sessions/6b4eb369-5649-4d3a-a178-97cc2abea538 Co-authored-by: dvir001 <39403717+dvir001@users.noreply.github.com>
Agent-Logs-Url: https://github.com/dvir001/Simple-Org-Chart/sessions/6b4eb369-5649-4d3a-a178-97cc2abea538 Co-authored-by: dvir001 <39403717+dvir001@users.noreply.github.com>
Implemented all requested fixes in commit Screenshot: This includes: filtered-users default scope corrected to |
…and missing-photo classification Agent-Logs-Url: https://github.com/dvir001/Simple-Org-Chart/sessions/6b4eb369-5649-4d3a-a178-97cc2abea538 Co-authored-by: dvir001 <39403717+dvir001@users.noreply.github.com>
Delete data/.scheduler.lock and data/data_update_status.json to clear a stale scheduler lock and the last update status (which contained an "Access token retrieval failed" error). This cleans up state so the scheduler/update process won't remain stuck on the previous failure.
This pull request enhances the reporting and filtering capabilities of the
simple_org_chartapplication by introducing new API endpoints for missing photo reports, adding flexible tag-based filtering, and standardizing filter argument parsing across multiple report endpoints. It also improves the metadata API and introduces a scope filter to limit results to org chart employees when needed.New features:
get_missing_photo_report,export_missing_photo_report,MISSING_PHOTO_FILE,load_missing_photo_data,apply_missing_photo_filters) [1] [2]apply_tagpicker_filters,_parse_tagpicker_args, usage in all report endpoints) [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15]Improvements to filtering and API consistency:
_parse_standard_toggle_args, simplifying filter handling and making filter application more consistent. [1] [2] [3] [4]scopeparameter to multiple endpoints, allowing users to restrict results to org chart employees or include all records. (_apply_scope_filter, usage in all report endpoints) [1] [2] [3] [4] [5] [6] [7]Metadata and auxiliary improvements:
get_metadata_options)These changes provide users with more powerful and flexible ways to generate, filter, and export organizational reports, while also making the codebase easier to maintain and extend.