Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed Filter For pending showing paid bounties #627

Merged
merged 2 commits into from
Nov 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 29 additions & 7 deletions src/store/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -971,7 +971,7 @@ export class MainStore {

getWantedsSpecWorkspacePrevParams?: QueryParams = {};
async getSpecificWorkspaceBounties(uuid: string, params?: any): Promise<PersonBounty[]> {
const queryParams: QueryParams = {
let queryParams: QueryParams = {
limit: queryLimit,
sortBy: 'created',
search: uiStore.searchText ?? '',
Expand All @@ -985,12 +985,34 @@ export class MainStore {
this.getWantedsSpecWorkspacePrevParams = queryParams;
}

// if we don't pass the params, we should use previous params for invalidate query
const query2 = this.appendQueryParams(
`workspaces/bounties/${uuid}`,
queryLimit,
params ? queryParams : this.getWantedsWorkspacePrevParams
);
let newParams = {};
if (params.Pending === 'true' || params.Pending === true) {
if (params.Paid === 'false' || params.Paid === false) {
newParams = {
page: 1,
resetPage: true,
Open: false,
Assigned: false,
Paid: false,
Completed: true,
Pending: false,
Failed: false,
pending: true,
languageString: '',
direction: 'desc'
};
}
}

// Use newParams if the condition is met; otherwise, fallback to existing params
queryParams =
(params.Pending === 'true' || params.Pending === true) &&
(params.Paid === 'false' || params.Paid === false)
? newParams
: params;

const query2 = this.appendQueryParams(`workspaces/bounties/${uuid}`, queryLimit, queryParams);

try {
const ps2 = await api.get(query2);
const ps3: any[] = [];
Expand Down
Loading