mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +01:00
refactor: rename containsYear to isSpammyCategory
This is done as the name containsYear is ambiguous. It not just checks for year to identify spammy categories.
This commit is contained in:
parent
4fe4310343
commit
fe74c77abf
3 changed files with 6 additions and 5 deletions
|
|
@ -27,11 +27,12 @@ class CategoriesModel @Inject constructor(
|
|||
private var selectedExistingCategories: MutableList<String> = mutableListOf()
|
||||
|
||||
/**
|
||||
* Returns true if the item contains an year which should be ignored
|
||||
* @param item
|
||||
* Returns true if an item is considered to be a spammy category which should be ignored
|
||||
*
|
||||
* @param item a category item that needs to be validated to know if it is spammy or not
|
||||
* @return
|
||||
*/
|
||||
fun containsYear(item: String): Boolean {
|
||||
fun isSpammyCategory(item: String): Boolean {
|
||||
//Check for current and previous year to exclude these categories from removal
|
||||
val now = Calendar.getInstance()
|
||||
val curYear = now[Calendar.YEAR]
|
||||
|
|
|
|||
|
|
@ -149,7 +149,7 @@ public class UploadRepository {
|
|||
* @return
|
||||
*/
|
||||
public boolean containsYear(String name) {
|
||||
return categoriesModel.containsYear(name);
|
||||
return categoriesModel.isSpammyCategory(name);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -156,7 +156,7 @@ class UploadRepositoryUnitTest {
|
|||
@Test
|
||||
fun testContainsYear() {
|
||||
assertEquals(
|
||||
repository.containsYear(""), categoriesModel.containsYear("")
|
||||
repository.containsYear(""), categoriesModel.isSpammyCategory("")
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue