Skip to content

Commit

Permalink
Prettified Code!
Browse files Browse the repository at this point in the history
  • Loading branch information
IanSkelskey authored and actions-user committed Jul 28, 2024
1 parent 23915ad commit a66aaeb
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 25 deletions.
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
Expand Down
6 changes: 4 additions & 2 deletions public/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
Expand Down Expand Up @@ -67,7 +67,9 @@
}
#message,
#message a {
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
box-shadow:
0 1px 3px rgba(0, 0, 0, 0.12),
0 1px 2px rgba(0, 0, 0, 0.24);
}
#load {
color: rgba(0, 0, 0, 0.4);
Expand Down
44 changes: 22 additions & 22 deletions src/utils/firestore.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { Type } from '../components/Notifier';
export const getArthropodLabels = async () => {
let labelArray = [];
await getDocs(
query(collection(db, 'AnswerSet'), where('set_name', '==', 'ArthropodSpecies'))
query(collection(db, 'AnswerSet'), where('set_name', '==', 'ArthropodSpecies')),
).then((snapshot) => {
snapshot.docs[0].data().answers.forEach((ans) => {
labelArray.push(ans.primary);
Expand All @@ -44,7 +44,7 @@ const getDocsFromCollection = async (collectionName, constraints = []) => {
const currentQuery = query(
collection(db, collectionName),
orderBy('dateTime', 'desc'),
...constraints
...constraints,
);
const docs = await getDocs(currentQuery);
// console.log(`Read ${docs.size} docs from ${collectionName}.`);
Expand Down Expand Up @@ -158,11 +158,11 @@ const editSessionAndItsEntries = async (sessionSnapshot, sessionData) => {
db,
`${sessionSnapshot.ref.parent.id.substr(
0,
sessionSnapshot.ref.parent.id.length - 7
)}Data`
sessionSnapshot.ref.parent.id.length - 7,
)}Data`,
),
where('sessionId', '==', sessionSnapshot.data().sessionId)
)
where('sessionId', '==', sessionSnapshot.data().sessionId),
),
);
const batch = writeBatch(db);
let entryCount = 0;
Expand All @@ -177,7 +177,7 @@ const editSessionAndItsEntries = async (sessionSnapshot, sessionData) => {
return pushEntryChangesToFirestore(
sessionSnapshot,
sessionData,
`Session ${entryCount > 0 && `and its ${entryCount} entries`} successfully changed`
`Session ${entryCount > 0 && `and its ${entryCount} entries`} successfully changed`,
);
};

Expand All @@ -188,14 +188,14 @@ const deleteSessionAndItsEntries = async (sessionSnapshot) => {
db,
`${sessionSnapshot.ref.parent.id.substr(
0,
sessionSnapshot.ref.parent.id.length - 7
)}Data`
sessionSnapshot.ref.parent.id.length - 7,
)}Data`,
),
or(
where('sessionDateTime', '==', sessionSnapshot.data().dateTime),
where('sessionId', '==', sessionSnapshot.data().sessionId)
)
)
where('sessionId', '==', sessionSnapshot.data().sessionId),
),
),
);
console.log(entries);
let entryCount = 0;
Expand All @@ -205,7 +205,7 @@ const deleteSessionAndItsEntries = async (sessionSnapshot) => {
});
return deleteDocumentFromFirestore(
sessionSnapshot,
`Session ${entryCount > 0 ? `and its ${entryCount} entries` : ''} successfully deleted`
`Session ${entryCount > 0 ? `and its ${entryCount} entries` : ''} successfully deleted`,
);
};

Expand All @@ -225,7 +225,7 @@ const startEntryOperation = async (operationName, operationData) => {

const getSitesForProject = async (projectName) => {
const answerSet = await getDocs(
query(collection(db, 'AnswerSet'), where('set_name', '==', `${projectName}Sites`))
query(collection(db, 'AnswerSet'), where('set_name', '==', `${projectName}Sites`)),
);
const options = [];
answerSet.docs.forEach((doc) => {
Expand All @@ -240,8 +240,8 @@ const getArraysForSite = async (projectName, siteName) => {
const answerSet = await getDocs(
query(
collection(db, 'AnswerSet'),
where('set_name', '==', `${projectName}${siteName}Array`)
)
where('set_name', '==', `${projectName}${siteName}Array`),
),
);
const options = [];
answerSet.docs.forEach((doc) => {
Expand All @@ -254,7 +254,7 @@ const getArraysForSite = async (projectName, siteName) => {

const getTrapStatuses = async () => {
const answerSet = await getDocs(
query(collection(db, 'AnswerSet'), where('set_name', '==', 'trap statuses'))
query(collection(db, 'AnswerSet'), where('set_name', '==', 'trap statuses')),
);
const options = [];
answerSet.docs.forEach((doc) => {
Expand All @@ -267,7 +267,7 @@ const getTrapStatuses = async () => {

const getFenceTraps = async () => {
const answerSet = await getDocs(
query(collection(db, 'AnswerSet'), where('set_name', '==', 'Fence Traps'))
query(collection(db, 'AnswerSet'), where('set_name', '==', 'Fence Traps')),
);
const options = [];
answerSet.docs.forEach((doc) => {
Expand All @@ -280,7 +280,7 @@ const getFenceTraps = async () => {

const getSexes = async () => {
const answerSet = await getDocs(
query(collection(db, 'AnswerSet'), where('set_name', '==', 'Sexes'))
query(collection(db, 'AnswerSet'), where('set_name', '==', 'Sexes')),
);
const options = [];
answerSet.docs.forEach((doc) => {
Expand All @@ -298,8 +298,8 @@ const getSessionsByProjectAndYear = async (environment, projectName, year) => {
collection(db, `${environment}${projectName}Session`),
where('dateTime', '>=', `${year}/01/01 00:00:00`),
where('dateTime', '<=', `${year}/12/31 23:59:59`),
orderBy('dateTime', 'desc')
)
orderBy('dateTime', 'desc'),
),
);
// console.log('sessions', sessions.docs);
return sessions.docs;
Expand All @@ -308,7 +308,7 @@ const getSessionsByProjectAndYear = async (environment, projectName, year) => {
const getSpeciesCodesForProjectByTaxa = async (project, taxa) => {
// console.log(`${project}${taxa}Species`);
const answerSet = await getDocs(
query(collection(db, 'AnswerSet'), where('set_name', '==', `${project}${taxa}Species`))
query(collection(db, 'AnswerSet'), where('set_name', '==', `${project}${taxa}Species`)),
);
const options = [];
answerSet.docs.forEach((doc) => {
Expand Down

0 comments on commit a66aaeb

Please sign in to comment.