Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add getPlagiarismRecordsCount function, and show open case count #187

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

theresnotime
Copy link
Member

@theresnotime theresnotime commented Sep 24, 2024

Adds a function named getPlagiarismRecordsCount, which accepts the same filtering options as getPlagiarismRecords, has a higher limit (200) and caches the count result for 15 minutes.

This is called in AppController as such:

$open_records_count = $copyPatrolRepo->getPlagiarismRecordsCount(
	array_merge(
		$options,
		[
			'filter' => CopyPatrolRepository::FILTER_OPEN
		]
	)
);
// If there are 200 (or more) open records, we just show "200+".
if ( $open_records_count >= 200 ) {
	$ret['open_records_count'] = "200+";
} else {
	$ret['open_records_count'] = $open_records_count;
}

Requesting more than 200 records to count appears to be detrimental to performance, so currently if the result is 200 (or more), the string 200+ is displayed.
image

The count is wrapped in <span id="open_records_count" data-count="{{ open_records_count }}">{{ open_records_count }}</span> to make it marginally easier to parse the page with a bot/etc (as it was mentioned that an on-wiki rough count would also be beneficial)

Bug: T375528

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant