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
# Editor directories and files
.vscode
.vscode/*
!.vscode/extensions.json
.idea

View file

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

View file

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