Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: streamline firestore operations and improve readability
This commit significantly refines and optimizes the firestore.js file, enhancing the efficiency and legibility of the firestore operations. Major changes include the simplification of database queries, the consolidation of similar functions into a single reusable function, and the removal of redundant code. Key changes made: - Streamlined `getArthropodLabels`, `getSitesForProject`, `getArraysForSite`, `getTrapStatuses`, `getFenceTraps`, and `getSexes` functions by introducing a generic `getAnswerSetOptions` function. - Optimized `getDocsFromCollection` and `deleteDocFromCollection` functions for clearer, more concise logic. - Refactored `editSessionAndItsEntries` and `deleteSessionAndItsEntries` to efficiently utilize batch operations and promise handling. - Cleaned up `uploadNewEntry` to prevent unnecessary checks and streamline the handling of Arthropod-specific logic. - Improved code styling consistency across the file, including the usage of template literals and arrow functions, and applying proper spacing for readability. Files and directories affected: - Modified `src/utils/firestore.js` for optimizations and refactoring. - Minor styling and consistency adjustments in `src/tools/DataManager.jsx`.
- Loading branch information