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

39 add request #54

Open
wants to merge 31 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
8b4ffa0
add transaction panel with mocked data
MrDell1 Jan 22, 2023
5ee16d6
add _markCollected and change name to RewardManagerService
MrDell1 Jan 22, 2023
04bd5da
remove react-table
MrDell1 Jan 22, 2023
9c097cd
delete react-table
MrDell1 Jan 27, 2023
99ef586
Merge branch 'develop' into 36-add-transaction-panel
MrDell1 Feb 3, 2023
f2ba0fe
Merge branch 'develop' into 36-add-transaction-panel
MrDell1 Feb 13, 2023
d6ffd5b
add AwardsPanel
MrDell1 Feb 14, 2023
2c83cfd
add RequestPanel
MrDell1 Feb 14, 2023
be53f2d
connect to smart contract
MrDell1 Feb 14, 2023
72c38ea
Merge branch '40-add-awards' into 39-add-request
MrDell1 Feb 14, 2023
d715e63
add reedem handler
MrDell1 Feb 14, 2023
e153d0c
Merge branch 'develop' into 39-add-request
MrDell1 Feb 14, 2023
afd74b2
add send request handler
MrDell1 Feb 14, 2023
a523112
add user panel
MrDell1 Feb 14, 2023
ad7300c
edit _createPaymentRequest
MrDell1 Feb 14, 2023
7843fa7
edit placeOrder
MrDell1 Feb 14, 2023
0ec02d0
edit placeOrder
MrDell1 Feb 14, 2023
4fc7ec0
edit ttpsc value
MrDell1 Feb 14, 2023
d297ff0
edit placeOrder
MrDell1 Feb 14, 2023
fb6191e
fix GetAllOrders()
Feb 14, 2023
3355f0b
Merge branch 'develop' into 39-add-request
Feb 14, 2023
4216929
refactor _getTransactionData
MrDell1 Feb 14, 2023
4aa9625
placeOrder is waiting for allowance confirmation
Feb 14, 2023
28abd70
Merge branch '39-add-request' of https://github.com/innowacja2022-dap…
Feb 14, 2023
d9bde7f
add logs
Feb 14, 2023
6aac092
refactor _getTransactionData
MrDell1 Feb 14, 2023
4cab6a2
Merge branch '39-add-request' of https://github.com/innowacja2022-dap…
MrDell1 Feb 14, 2023
e42c1e3
update AwardCard
MrDell1 Feb 14, 2023
9cf3fa4
done with _getTransactionData
MrDell1 Feb 15, 2023
6b156fa
check is admin
MrDell1 Feb 15, 2023
e9282ea
hot fix editAward
MrDell1 Feb 15, 2023
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
24 changes: 14 additions & 10 deletions contracts/RewardsManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -177,12 +177,17 @@ contract RewardsManager {
return result;
}

struct OrderDetails {
uint256 id;
uint256 pendingQuantity;
}

struct PendingOrderDto {
address user;
uint256[] rewardsArray;
uint256[] pendingArray;
OrderDetails[] orders;
}


function getAllPendingOrders()
public
view
Expand All @@ -199,22 +204,21 @@ contract RewardsManager {

if (paymentsManager.isCurrentEmployee(user)) {

uint256[] memory rewardsArray = new uint256[](rewardCount);
uint256[] memory pendingArray = new uint256[](rewardCount);
OrderDetails[] memory userOrders = new OrderDetails[](rewardCount);

for (uint256 i = 0; i < rewardCount; i++) {
rewardsArray[i] = rewards[i].id;
OrderDetails memory order;
order.id = rewards[i].id;

if (orders[user][i] > 0) {
pendingArray[i] = orders[user][i] - collected[user][i];
} else {
pendingArray[i] = 0;
order.pendingQuantity = orders[user][i] - collected[user][i];
}
userOrders[i] = order;
}

PendingOrderDto memory dto = PendingOrderDto(
user,
rewardsArray,
pendingArray
userOrders
);

dtos[dtoCounter] = dto;
Expand Down
Loading