Open Sessions (To be removed)
Description
The Open Sessions screen displays all open (unclosed) zone check-in sessions found on the scanner device. This screen appears after login when a user with manager/auditor role attempts to log in and there are open sessions from other users or previous sessions that need to be closed. The screen allows managers to review, sync (close), or resume these open sessions. Each session displays verification status and sync readiness based on audit quotas and verification requirements.
When This Screen Appears
Login Flow Context
After a user logs in, the system checks for open sessions:
- PerformLogin executes and checks for open zone check-ins.
- Three Possible Outcomes:
- Response.CurrentUser: The logged-in user has their own open session → Shows dialog to resume it.
- Response.CanSyncSession: User has manager/auditor role AND there are other open sessions → Navigates to Open Sessions screen.
- Response.Successful: No open sessions or regular user → Proceeds to home screen.
Who Sees This Screen
From the login documentation and code:
- Managers/Auditors: Users with elevated roles who can sync sessions from other users.
- Condition:
user.hasRole()returns true AND there are open zone check-ins. - Purpose: Allows managers to clean up unfinished sessions before starting their own work.
What Are Open Sessions
Open sessions are zone check-ins where:
closedAtis null (session not yet closed).- Session may belong to:
- Another user who didn't complete verification.
- The same user from a previous interrupted session.
- A different device if sessions are shared across devices.
Screen Functionality
GetZoneCheckIns - Fetching Open Sessions
When the screen loads:
- Query All Zone Check-Ins: Loads all zone check-in records for the current project.
- Filter Open Sessions: Keeps only records where
closedAt == null. - Convert to Session Objects: For each open zone check-in:
- Gets number of scans (
GetNumberOfScans). - Gets customer/client name (
GetCustomer). - Calculates sync readiness (
GetVerifyStatus).
- Gets number of scans (
- Auto-Navigate: If no open sessions exist, automatically navigates to Home screen.
- Display List: Shows all open sessions with their details.
Session Information Displayed
Each session in the list shows:
- Zone Code: The zone identifier for this session.
- Project Name: Which project the session belongs to.
- User Name: Who started this session.
- Mode: Scan, PositionCountVerify, or ZoneCountVerify.
- Number of Scans: Total scans in the session.
- Customer: Client/customer name.
- Device Code: Which scanner device created the session.
- Sync Ready Status: Whether the session can be synced (closed).
Navigation Between Sessions
- Select Next: Move to the next session in the list (wraps to first).
- Select Previous: Move to the previous session in the list (wraps to last).
- Select by Touch: Tap any session to select it.
- First Session Default: The first session is automatically selected on load.
Available Actions
View Session
- Opens the session in its respective mode:
- Scan Mode: Navigates to Add Scans screen with the session ID.
- Verify Modes: Navigates to Verify screen with the session ID and mode.
- Allows user to complete or continue the work.
- Useful when the session needs additional scanning or verification.
Sync Session
- Closes the session by setting
closedAtto current timestamp. - Enqueues for upload to sync the session data to the server.
- Removes from list: After successful sync, session disappears from open sessions.
- Auto-select next: Automatically selects the next session in the list.
- Only if Ready: Sync button is enabled only when
isSyncReady = true.
Sync Readiness - Why a Session Can Be Synced or Not
GetVerifyStatus - Calculating Sync Readiness
For each session, the system determines if it's ready to be synced:
Scan Mode Sessions:
- Always Ready: Scan mode sessions can always be synced.
- No verification requirements.
- Simply closes the session and uploads scans.
Verify Mode Sessions (PositionCountVerify, ZoneCountVerify):
- Conditional: Must meet audit requirements.
- Calculates
AuditingStatsfor the session. - Checks if
auditStatus == AuditStatus.Complete.
Auditing Stats Calculation
The system evaluates verification completeness:
-
Get Scan Groups: Groups all scans in the session using the same logic as Verify screen.
-
Filter Non-Added Scans: Excludes scans from AddScans session (only verify sessions count).
-
Calculate Metrics:
- verifyDone: Number of scans marked as verified.
- verifyTotal: Total scans that need verification.
- totalDone: All verified scans (regardless of need).
- totalScans: Total number of scans (non-added).
- auditQuota: Required percentage from configuration.
- shouldVerifyMandatory: Whether mandatory items must be verified.
- verifiedMandatory: Whether all mandatory items are verified.
-
Determine Audit Status:
- Complete: Zone is empty OR (quota met AND mandatory verified).
- QuotaNotAchieved: Percentage of verified scans < audit quota.
- NotAllMandatoryVerified: Quota met but mandatory items not verified.
Why a Session CANNOT Be Synced
Quota Not Met
- Condition:
(totalDone / totalScans * 100) < auditQuota - Example: Audit quota is 80%, but only 60% of scans are verified.
- Reason: Insufficient verification coverage.
- Solution: User must "View" the session and verify more scan groups until quota is met.
Mandatory Items Not Verified
- Condition:
shouldVerifyMandatory == trueAND some scans withneedsVerification = trueare not verified. - Example: Items marked as mandatory haven't been checked yet.
- Reason: Critical items must be verified before closing.
- Solution: User must "View" the session and verify all mandatory items.
Empty Zone
- Condition: Zone has no scans (after filtering AddScans).
- Status: Actually allows sync (considered Complete).
- Reason: Nothing to verify means verification is complete.
Why a Session CAN Be Synced
Scan Mode
- Reason: Scan sessions don't require verification.
- Status:
isSyncReady = truealways. - Action: Closes session and uploads scan data.
Verify Mode - Complete Audit
- Conditions Met:
- Percentage of verified scans >= audit quota.
- All mandatory items are verified (if required).
- OR zone is empty.
- Status:
auditStatus == AuditStatus.Complete→isSyncReady = true. - Action: Closes session and uploads verification results.
Visual Indicators
Based on isSyncReady:
- True: Sync button is enabled (ready to close).
- False: Sync button is disabled (must complete verification first).
- User can see which sessions are ready and which need more work.
Complete Flow Examples
Example 1: Manager Syncing Complete Verify Session
Scenario:
- Manager logs in.
- Employee left an open PositionCountVerify session.
- Audit quota: 75%, employee verified 80% of items.
- All mandatory items verified.
Flow:
- Login succeeds →
PerformLogin.Response.CanSyncSession. - Navigate to Open Sessions screen.
- Screen loads: Shows 1 open session.
- Session details: Employee name, zone code, 80% verified, isSyncReady = true.
- Manager reviews: Sees "Sync" button is enabled.
- Manager taps "Sync".
- System calls
ZoneCheckOut:- Sets
closedAtto current time. - Enqueues session for server upload.
- Sets
- Session removed from list.
- No more open sessions → Auto-navigate to Home screen.
Example 2: Manager Views Incomplete Session
Scenario:
- Manager logs in.
- Employee left open session with only 50% verified.
- Audit quota: 75%.
Flow:
- Navigate to Open Sessions screen.
- Session shows: 50% verified, isSyncReady = false.
- "Sync" button is disabled.
- Manager taps "View" button.
- Opens session in Verify screen.
- Manager verifies additional groups until 75%+ reached.
- Returns to Open Sessions (or syncs from verify screen).
- Session now shows isSyncReady = true.
- Manager can now sync the session.
Example 3: Multiple Open Sessions
Scenario:
- Three employees left open sessions.
- Session 1: Scan mode (always ready).
- Session 2: Verify mode, 90% verified (ready).
- Session 3: Verify mode, 40% verified (not ready).
Flow:
- Open Sessions shows 3 sessions.
- First session (Scan) is selected by default.
- Manager syncs Session 1 → Removed, Session 2 auto-selected.
- Manager syncs Session 2 → Removed, Session 3 auto-selected.
- Session 3: "Sync" disabled.
- Manager taps "View" → Opens in Verify screen.
- Manager completes verification or decides to keep for employee.
- Returns and syncs or leaves for employee to finish.
Fields
No input fields - this is a selection and action screen.
Error Messages
No specific error messages documented for this screen. Errors from ZoneCheckOut or GetVerifyStatus would be displayed if sync fails.