Rename variables and ignore the entire vscode folder

This commit is contained in:
Niko Reunanen 2025-03-01 09:21:24 +02:00
parent a96ac9fbe1
commit ff6804a6e7
Signed by: nreunane
GPG key ID: D192625387DB0F16
3 changed files with 19 additions and 18 deletions

1
.gitignore vendored
View file

@ -13,6 +13,7 @@ dist-ssr
*.local *.local
# Editor directories and files # Editor directories and files
.vscode
.vscode/* .vscode/*
!.vscode/extensions.json !.vscode/extensions.json
.idea .idea

View file

@ -17,13 +17,13 @@ const date = ref(new Date());
const email = ref(""); const email = ref("");
const failedLogin = ref(false); const failedLogin = ref(false);
const isLogged = ref(pb.authStore.isValid); const isLogged = ref(pb.authStore.isValid);
const org = ref(""); const organisation = ref("");
const organisations = ref<Organisation[]>([]); const organisations = ref<Organisation[]>([]);
const password = ref(""); const password = ref("");
const projects = ref<Project[]>([]); const projects = ref<Project[]>([]);
const toast = useToast(); const toast = useToast();
watch(org, async () => { watch(organisation, async () => {
await getProjects(); await getProjects();
}); });
@ -59,7 +59,7 @@ async function logout() {
} }
async function getProjects() { async function getProjects() {
const filter = pb.filter("organisation = {:organisation}", { organisation: org.value }); const filter = pb.filter("organisation = {:organisation}", { organisation: organisation.value });
const records = await pb.collection<Project>("projects").getFullList(500, { const records = await pb.collection<Project>("projects").getFullList(500, {
filter, filter,
@ -72,8 +72,8 @@ async function getProjects() {
async function getOrganisations() { async function getOrganisations() {
const records = await pb.collection<Organisation>("organisations").getFullList(); const records = await pb.collection<Organisation>("organisations").getFullList();
organisations.value = [...records]; organisations.value = [...records];
if (org.value === "" && records.length > 0) { if (organisation.value === "" && records.length > 0) {
org.value = records[0].id; organisation.value = records[0].id;
} }
} }
@ -88,13 +88,13 @@ function setDate(newDate: Date) {
<template #center> <template #center>
<template v-if="isLogged"> <template v-if="isLogged">
<Select <Select
v-model="org" v-model="organisation"
:options="organisations" :options="organisations"
optionLabel="name" optionLabel="name"
optionValue="id" optionValue="id"
placeholder="Organisation" placeholder="Organisation"
/> />
<Controls @date="setDate" :projects="projects" :org="org" v-if="org !== ''" /> <Controls @date="setDate" :projects="projects" :org="organisation" v-if="organisation !== ''" />
</template> </template>
</template> </template>
<template #end> <template #end>
@ -109,9 +109,9 @@ function setDate(newDate: Date) {
</template> </template>
</Toolbar> </Toolbar>
<EntryTable <EntryTable
:org="org" :org="organisation"
:date="date" :date="date"
:projects="projects" :projects="projects"
v-if="isLogged && org !== ''" v-if="isLogged && organisation !== ''"
/> />
</template> </template>

View file

@ -30,17 +30,17 @@ const props = defineProps<{
projects: Project[]; projects: Project[];
}>(); }>();
const orgWatch = toRef(() => props.org);
const dateWatch = toRef(() => props.date);
const entries = ref<Entry[]>([]);
const editingRows = ref([]); const editingRows = ref([]);
const entries = ref<Entry[]>([]);
const newEntrySelection = ref(""); const newEntrySelection = ref("");
const watchDate = toRef(() => props.date);
const watchOrganisation = toRef(() => props.org);
watch(dateWatch, () => { watch(watchDate, () => {
getEntries().then(); getEntries().then();
}); });
watch(orgWatch, () => { watch(watchOrganisation, () => {
getEntries().then(); getEntries().then();
}); });
@ -69,15 +69,15 @@ const summaries = computed(() => {
} }
const result: { key: string; start: Date; end: Date }[] = []; const result: { key: string; start: Date; end: Date }[] = [];
let cumsum = 0; let cumulative_sum = 0;
for (const key in minutes) { for (const key in minutes) {
const start = new Date(props.date.getTime()); const start = new Date(props.date.getTime());
start.setHours(8, 0, 0); start.setHours(8, 0, 0);
start.setMinutes(start.getMinutes() + cumsum); start.setMinutes(start.getMinutes() + cumulative_sum);
cumsum += minutes[key]; cumulative_sum += minutes[key];
const end = new Date(props.date.getTime()); const end = new Date(props.date.getTime());
end.setHours(8, 0, 0); end.setHours(8, 0, 0);
end.setMinutes(end.getMinutes() + cumsum); end.setMinutes(end.getMinutes() + cumulative_sum);
result.push({ key, start, end }); result.push({ key, start, end });
} }