This repository was archived by the owner on Oct 20, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
[WIP] feat: Call should end explicitly instead of endCall date #668
Draft
martin-trajanovski
wants to merge
25
commits into
develop
Choose a base branch
from
SWAP-2465-end-call-after-cycle-end
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
f44f3d5
feat: Call should end on endCycle instead of endCall date
martin-trajanovski a339ef1
Merge branch 'develop' into SWAP-2465-end-call-after-cycle-end
martin-trajanovski dae940d
Merge branch 'develop' into SWAP-2465-end-call-after-cycle-end
martin-trajanovski ac77bf6
Merge branch 'develop' into SWAP-2465-end-call-after-cycle-end
martin-trajanovski c1ba916
Merge branch 'develop' into SWAP-2465-end-call-after-cycle-end
martin-trajanovski cd0afcc
revert some changes and fix the call end by cycle date
martin-trajanovski a94a878
Merge branch 'develop' into SWAP-2465-end-call-after-cycle-end
martin-trajanovski 135ba52
Merge branch 'develop' into SWAP-2465-end-call-after-cycle-end
martin-trajanovski 8efce0a
Merge branch 'develop' into SWAP-2465-end-call-after-cycle-end
martin-trajanovski a759010
Merge branch 'develop' into SWAP-2465-end-call-after-cycle-end
martin-trajanovski bb01167
Merge branch 'develop' into SWAP-2465-end-call-after-cycle-end
martin-trajanovski 69d2562
feat: Change isActive logic on the call with introducing new flag in …
martin-trajanovski dec5e27
fix unit tests
martin-trajanovski 09e02e8
Fix the call ended comparisson and checks
martin-trajanovski b981842
Merge branch 'develop' into SWAP-2465-end-call-after-cycle-end
martin-trajanovski e7a5419
fix failing unit tests
martin-trajanovski 68cf2e8
Merge branch 'SWAP-2465-end-call-after-cycle-end' of https://github.c…
martin-trajanovski 72a4696
Merge branch 'develop' into SWAP-2465-end-call-after-cycle-end
martin-trajanovski 1908c24
Merge branch 'develop' into SWAP-2465-end-call-after-cycle-end
martin-trajanovski 3804a0c
Merge branch 'develop' into SWAP-2465-end-call-after-cycle-end
martin-trajanovski 4c82bf5
Merge branch 'develop' into SWAP-2465-end-call-after-cycle-end
martin-trajanovski 733bfdb
Merge branch 'develop' into SWAP-2465-end-call-after-cycle-end
martin-trajanovski adc42d3
Merge branch 'develop' into SWAP-2465-end-call-after-cycle-end
martin-trajanovski 956668b
Merge branch 'develop' into SWAP-2465-end-call-after-cycle-end
martin-trajanovski e4486f0
Merge branch 'develop' into SWAP-2465-end-call-after-cycle-end
martin-trajanovski File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| DO | ||
| $$ | ||
| BEGIN | ||
| IF register_patch('AddIsActiveCallFlag.sql', 'Martin Trajanovski', 'Add is_active flag to the calls table', '2022-06-21') THEN | ||
|
|
||
| ALTER TABLE "call" | ||
| ADD COLUMN is_active boolean DEFAULT true; | ||
|
|
||
| END IF; | ||
| END; | ||
| $$ | ||
| LANGUAGE plpgsql; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -42,21 +42,25 @@ export default class PostgresCallDataSource implements CallDataSource { | |
|
|
||
| // if filter is explicitly set to true or false | ||
| if (filter?.isActive === true) { | ||
| const currentDate = new Date().toISOString(); | ||
| query | ||
| .where('start_call', '<=', currentDate) | ||
| .andWhere('end_call', '>=', currentDate); | ||
| query.where('is_active', true); | ||
| } else if (filter?.isActive === false) { | ||
| const currentDate = new Date().toISOString(); | ||
| query | ||
| .where('start_call', '>=', currentDate) | ||
| .orWhere('end_call', '<=', currentDate); | ||
| query.where('is_active', false); | ||
| } | ||
|
|
||
| /** | ||
| * NOTE: We are comparing dates instead of using the call_ended flag, | ||
| * because the flag is set once per hour and we could have a gap. | ||
| * TODO: Maybe there is a need to use the timezone setting here but not quite sure about it. Discussion is needed here! | ||
| */ | ||
| const currentDate = new Date().toISOString(); | ||
| if (filter?.isEnded === true) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is the filter value |
||
| query.where('call_ended', true); | ||
| query | ||
| .where('start_call', '>=', currentDate) | ||
| .andWhere('end_call', '<=', currentDate); | ||
| } else if (filter?.isEnded === false) { | ||
| query.where('call_ended', false); | ||
| query | ||
| .where('start_call', '<=', currentDate) | ||
| .andWhere('end_call', '>=', currentDate); | ||
| } | ||
|
|
||
| if (filter?.isReviewEnded === true) { | ||
|
|
@@ -233,6 +237,7 @@ export default class PostgresCallDataSource implements CallDataSource { | |
| allocation_time_unit: args.allocationTimeUnit, | ||
| title: args.title, | ||
| description: args.description, | ||
| is_active: args.isActive, | ||
| }, | ||
| ['*'] | ||
| ) | ||
|
|
@@ -315,7 +320,7 @@ export default class PostgresCallDataSource implements CallDataSource { | |
| return records.map(createCallObject); | ||
| } | ||
|
|
||
| public async checkActiveCall(callId: number): Promise<boolean> { | ||
| public async isCallEnded(callId: number): Promise<boolean> { | ||
| const currentDate = new Date().toISOString(); | ||
|
|
||
| return database | ||
|
|
@@ -325,6 +330,6 @@ export default class PostgresCallDataSource implements CallDataSource { | |
| .andWhere('end_call', '>=', currentDate) | ||
| .andWhere('call_id', '=', callId) | ||
| .first() | ||
| .then((call: CallRecord) => (call ? true : false)); | ||
| .then((call: CallRecord) => (call ? false : true)); | ||
| } | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would have thought this would be fine as
new Date().toISOString()and start_call and end_call is all in UTCThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@simonfernandes thank you I can remove the comment then. 🙂