Skip to content

Commit

Permalink
Merge pull request #28 from xeptagondev/iverfiy-rdc-be
Browse files Browse the repository at this point in the history
Iverfiy rdc be
  • Loading branch information
palindaa authored Oct 22, 2024
2 parents e57fb3b + 3bf86d6 commit 7f34c7b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
9 changes: 6 additions & 3 deletions apps/triage/src/app/app.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export class AppService {
startTime = lastMeedanReport[0].node?.tasks?.edges?.find(task => task.node?.label === this.config.originalPostTimeField).node?.first_response_value
}
}
const postsCount = await this.unitedwaveClient.getPostsCount().toPromise();
const postsCount = await this.unitedwaveClient.getPostsCount(startTime).toPromise();
this.logger.log('Latest unitedwaveClient count', postsCount)
const postsPerPage = 50;
const pageCount = Math.ceil(Number(postsCount) / postsPerPage);
Expand All @@ -55,10 +55,13 @@ export class AppService {
const list = await this.unitedwaveClient.getPosts(page,startTime).toPromise();
for (let i = list.length - 1; i >= 0; i--) {
const post = list[i];
//check duplication
const title = [post?.clip_name, post?.keywords, post?.date_reported]
.filter(Boolean)
.join(' - ');
// check duplication
const isDuplicate = this.isDuplicatePost(post, createdPosts);
if (!isDuplicate) {
const item = await this.checkClient.createItemFromRadio(post?.clip_url, post?.clip_name, post?.source_text, post?.date_reported).toPromise();
const item = await this.checkClient.createItemFromRadio(post?.clip_url, title, post?.source_text, post?.date_reported).toPromise();
if(!item.error) {
createdItems = [...createdItems, item];
createdPosts = [...createdPosts, post];
Expand Down
5 changes: 4 additions & 1 deletion libs/unitedwave-client/src/lib/unitedwave-client.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,14 @@ export class UnitedwaveClientService{
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
}

getPostsCount(filter?:string) {
getPostsCount(startDate?: string,filter?:string) {
let query = this.config.endpoints.count + `?user[name]=${this.config.username}&user[secret]=${this.config.password}`;
if(filter) {
query += `&clip[filters]=${filter}`
}
if (startDate) {
query += `&clip[from_date]=${startDate}`
}
return this.http.post(query).pipe(
map(res => res.data),
retry(3),
Expand Down

0 comments on commit 7f34c7b

Please sign in to comment.