fix task sorting and individual task deadline issues on front page.
continuous-integration/drone/push Build is passing
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -189,7 +189,7 @@ export class StufflogClient {
|
||||
return data.task;
|
||||
}
|
||||
|
||||
async listTasks({active, expiring}: TaskFilter): Promise<TaskResult[]> {
|
||||
async listTasks({active, expiring, sort}: TaskFilter): Promise<TaskResult[]> {
|
||||
let queries = [];
|
||||
if (active != null) {
|
||||
queries.push(`active=${active}`);
|
||||
@@ -197,6 +197,9 @@ export class StufflogClient {
|
||||
if (expiring != null) {
|
||||
queries.push(`expiring=${expiring}`);
|
||||
}
|
||||
if (sort != null) {
|
||||
queries.push(`sort=${sort.join(",")}`)
|
||||
}
|
||||
|
||||
const query = queries.length > 0 ? `?${queries.join("&")}` : "";
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import stuffLogClient from "../clients/stufflog";
|
||||
import stuffLogClient from "../clients/stufflog";
|
||||
|
||||
import type { ProjectResult, ProjectUpdate } from "../models/project";
|
||||
import type { TaskResult } from "../models/task";
|
||||
@@ -7,7 +7,7 @@ import stuffLogClient from "../clients/stufflog";
|
||||
import type { ModalData } from "../stores/modal";
|
||||
import IS_MOBILE from "../utils/phone-check";
|
||||
import Icon from "./Icon.svelte";
|
||||
import ItemProgress from "./ItemProgress.svelte";
|
||||
import ItemProgress from "./ItemProgress.svelte";
|
||||
import Option from "./Option.svelte";
|
||||
import OptionRow from "./OptionRow.svelte";
|
||||
import ParentEntry from "./ParentEntry.svelte";
|
||||
|
||||
@@ -8,15 +8,11 @@
|
||||
export let tasks: TaskResult[];
|
||||
export let showAllOptions: boolean;
|
||||
export let header: string;
|
||||
|
||||
let sortedTasks: TaskResult[] = [];
|
||||
|
||||
$: sortedTasks = tasks.sort((a,b) => a.createdTime.localeCompare(b.createdTime))
|
||||
</script>
|
||||
|
||||
{#if tasks.length > 0}
|
||||
<h3>{header}</h3>
|
||||
{#each sortedTasks as task (task.id)}
|
||||
{#each tasks as task (task.id)}
|
||||
<TaskEntry
|
||||
showAllOptions={showAllOptions}
|
||||
task={task} project={project}
|
||||
|
||||
@@ -37,6 +37,7 @@ export interface TaskLink {
|
||||
export interface TaskFilter {
|
||||
active?: boolean
|
||||
expiring?: boolean
|
||||
sort?: string[]
|
||||
}
|
||||
|
||||
export interface TaskInput {
|
||||
|
||||
@@ -38,6 +38,7 @@ import ParentEntry from "../components/ParentEntry.svelte";
|
||||
fpTaskStore.load({
|
||||
active: true,
|
||||
expiring: true,
|
||||
sort: ["status"],
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -77,17 +78,19 @@ import ParentEntry from "../components/ParentEntry.svelte";
|
||||
|
||||
fakeProjects = [];
|
||||
fakeMap = {};
|
||||
console.log(individualTasks, $fpTaskStore.tasks);
|
||||
for (let task of individualTasks) {
|
||||
if (!task.project.active) {
|
||||
continue;
|
||||
}
|
||||
|
||||
let fakeProject = fakeProjects.find(p => p.id === task.id);
|
||||
let fakeProject = fakeProjects.find(p => p.id === task.projectId);
|
||||
if (fakeProject == null) {
|
||||
fakeMap[task.projectId] = true;
|
||||
fakeProjects.push({
|
||||
...task.project,
|
||||
tasks: [task],
|
||||
subtractions: [],
|
||||
});
|
||||
} else {
|
||||
fakeProject.tasks.push(task);
|
||||
|
||||
Reference in New Issue
Block a user