Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Synchronet
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Main
Synchronet
Commits
8f49209a
Commit
8f49209a
authored
4 months ago
by
Eric Oulashin
Browse files
Options
Downloads
Patches
Plain Diff
DDMsgReader: An optimization for loading status, for issue
#846
parent
51cb7273
No related branches found
No related tags found
1 merge request
!486
DDMsgReader: An optimization for loading status, for issue #846
Pipeline
#7436
passed
4 months ago
Stage: build
Stage: test
Stage: cleanup
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
xtrn/DDMsgReader/DDMsgReader.js
+13
-38
13 additions, 38 deletions
xtrn/DDMsgReader/DDMsgReader.js
with
13 additions
and
38 deletions
xtrn/DDMsgReader/DDMsgReader.js
+
13
−
38
View file @
8f49209a
...
...
@@ -16764,7 +16764,7 @@ function DigDistMsgReader_IndexedModeChooseSubBoard(pClearScreen, pDrawMenu, pDi
}
// Set text widths for the menu items
var newMsgWidthObj = findWidestNumMsgsAndNumNewMsgs(scanScope, newScanOnly);
var newMsgWidthObj = findWidestNumMsgsAndNumNewMsgs(scanScope, newScanOnly
, true
);
var numMsgsWidth = newMsgWidthObj.widestNumMsgs;
var numNewMsgsWidth = newMsgWidthObj.widestNumNewMsgs;
// Ensure the column widths for the last few columns (after description) are wide enough
...
...
@@ -16795,9 +16795,6 @@ function DigDistMsgReader_IndexedModeChooseSubBoard(pClearScreen, pDrawMenu, pDi
DigDistMsgReader_IndexedModeChooseSubBoard.selectedItemIdx = 0;
var numSubBoards = 0;
var totalNewMsgs = 0;
// The total number of sub-boards we'll scan - For displaying the progress percentage
if (typeof(DigDistMsgReader_IndexedModeChooseSubBoard.totalNumSubBoards) !== "number")
DigDistMsgReader_IndexedModeChooseSubBoard.totalNumSubBoards = countSubBoardsForScanning(scanScope, newScanOnly, true);
// Load the menu
for (var grpIdx = 0; grpIdx < msg_area.grp_list.length; ++grpIdx)
{
...
...
@@ -16821,7 +16818,7 @@ function DigDistMsgReader_IndexedModeChooseSubBoard(pClearScreen, pDrawMenu, pDi
++numSubBoards;
// Calculate & display progress percentage (every other sub-board)
var progressPercentage = numSubBoards /
DigDistMsgReader_IndexedModeChooseSubBoard.totalN
umSubBoards * 100.0;
var progressPercentage = numSubBoards /
newMsgWidthObj.n
umSubBoards * 100.0;
if (numSubBoards % 2 == 0)
printf("\rLoading: %0.2f% ", progressPercentage);
...
...
@@ -17309,19 +17306,24 @@ function DigDistMsgReader_ShowIndexedListHelp()
// This would be SCAN_SCOPE_SUB_BOARD, SCAN_SCOPE_GROUP, or SCAN_SCOPE_ALL.
// pForNewscanOnly: Boolean: Whether or not to only check sub-boards in the user's newscan configuration.
// Defaults to false.
// pDisplayStatusDots: Optional boolean - Whether or not to display status dots while this is running.
// Defaults to false.
//
// Return value: An object with the following properties:
// widestNumMsgs: The biggest length of the number of messages in the sub-boards
// widestNumNewMsgs: The biggest length of the number of new (unread) messages in the sub-boards
function findWidestNumMsgsAndNumNewMsgs(pScanScope, pForNewscanOnly)
// numSubBoards: The number of sub-boards in the newscan
function findWidestNumMsgsAndNumNewMsgs(pScanScope, pForNewscanOnly, pDisplayStatusDots)
{
var retObj = {
widestNumMsgs: 0,
widestNumNewMsgs: 0
widestNumNewMsgs: 0,
numSubBoards: 0
};
var scanScope = (isValidScanScopeVal(pScanScope) ? pScanScope : SCAN_SCOPE_ALL);
var onlyNewscanCfg = (typeof(pForNewscanOnly) === "boolean" ? pForNewscanOnly : false);
var displayStatusDots = (typeof(pDisplayStatusDots) === "boolean" ? pDisplayStatusDots : false);
for (var grpIdx = 0; grpIdx < msg_area.grp_list.length; ++grpIdx)
{
...
...
@@ -17349,6 +17351,10 @@ function findWidestNumMsgsAndNumNewMsgs(pScanScope, pForNewscanOnly)
var numNewMessagesInSubLen = latestPostInfo.numNewMsgs.toString().length;
if (numNewMessagesInSubLen > retObj.widestNumNewMsgs)
retObj.widestNumNewMsgs = numNewMessagesInSubLen;
// If we are to display status dots, then display a dot for every 4 sub-boards
if (displayStatusDots && retObj.numSubBoards % 4 == 0)
console.print(".");
}
}
return retObj;
...
...
@@ -25740,37 +25746,6 @@ function countOccurrencesInStr(pStr, pSubstr)
return count;
}
// Counts the number of sub-boards that would be scanned for the user,
// considering their sub-board access, for a particular scan scope
function countSubBoardsForScanning(pScanScope, pNewScanOnly, pDisplayStatusDots)
{
var displayStatusDots = (typeof(pDisplayStatusDots) === "boolean" ? pDisplayStatusDots : false);
var numSubBoards = 0;
for (var grpIdx = 0; grpIdx < msg_area.grp_list.length; ++grpIdx)
{
// If scanning the user's current group or sub-board and this is the wrong group, then skip this group.
if ((pScanScope == SCAN_SCOPE_GROUP || pScanScope == SCAN_SCOPE_SUB_BOARD) && bbs.curgrp != grpIdx)
continue;
for (var subIdx = 0; subIdx < msg_area.grp_list[grpIdx].sub_list.length; ++subIdx)
{
// Skip sub-boards that the user can't read or doesn't have configured for newscans
if (!msg_area.grp_list[grpIdx].sub_list[subIdx].can_read)
continue;
if (pNewScanOnly && !Boolean(msg_area.grp_list[grpIdx].sub_list[subIdx].scan_cfg & SCAN_CFG_NEW))
continue;
// If scanning the user's current sub-board and this is the wrong sub-board, then
// skip this sub-board (the other groups should have been skipped in the outer loop).
if (pScanScope == SCAN_SCOPE_SUB_BOARD && bbs.cursub != subIdx)
continue;
++numSubBoards;
// If we are to display status dots, then display a dot for every 4 sub-boards
if (displayStatusDots && numSubBoards % 4 == 0)
console.print(".");
}
}
return numSubBoards;
}
///////////////////////////////////////////////////////////////////////////////////
// For debugging: Writes some text on the screen at a given location with a given pause.
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment