Skip to content

Commit 71bc79d

Browse files
committed
rating fields added
1 parent 55c77d0 commit 71bc79d

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed

blockchain/source/contracts/Orders.sol

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ contract Orders is Administratable {
2424
struct Order {
2525
OrderInfo info;
2626
OrderParams params;
27+
RatingInfo ratingInfo;
2728
}
2829

2930
struct OrderInfo {
@@ -46,6 +47,13 @@ contract Orders is Administratable {
4647
uint dealID;
4748
}
4849

50+
struct RatingInfo {
51+
uint counterpartyRating;
52+
uint supplierVolume;
53+
uint workerRating;
54+
uint unavialSla;
55+
}
56+
4957
mapping(uint => Order) orders;
5058

5159
uint ordersAmount = 0;
@@ -116,6 +124,22 @@ contract Orders is Administratable {
116124
return orders[orderID].info.blacklist;
117125
}
118126

127+
function GetOrderWorkerrating(uint orderID) public view returns (uint) {
128+
return orders[orderID].ratingInfo.workerRating;
129+
}
130+
131+
function GetOrderCounterpartyrating(uint orderID) public view returns (uint) {
132+
return orders[orderID].ratingInfo.counterpartyRating;
133+
}
134+
135+
function GetOrderSupplierVolume(uint orderID) public view returns (uint) {
136+
return orders[orderID].ratingInfo.supplierVolume;
137+
}
138+
139+
function GetOrderSla(uint orderID) public view returns (uint) {
140+
return orders[orderID].ratingInfo.unavialSla;
141+
}
142+
119143
function SetOrderBlacklist(uint orderID, address newBlacklist) public onlyOwner {
120144
orders[orderID].info.blacklist = newBlacklist;
121145
}
@@ -168,6 +192,24 @@ contract Orders is Administratable {
168192
orders[orderID].params.dealID = _dealID;
169193
}
170194

195+
function SetOrderWorkerrating(uint orderID, uint _workerRating) public onlyOwner {
196+
orders[orderID].ratingInfo.workerRating = _workerRating;
197+
}
198+
199+
function SetOrderCounterpartyrating(uint orderID, uint _counterpartyRating) public onlyOwner {
200+
orders[orderID].ratingInfo.counterpartyRating = _counterpartyRating;
201+
}
202+
203+
function SetOrderSupplierVolume(uint orderID, uint _supplierVolume) public onlyOwner {
204+
orders[orderID].ratingInfo.supplierVolume = _supplierVolume;
205+
}
206+
207+
function SetOrderSla(uint orderID, uint _unavialSla) public onlyOwner {
208+
orders[orderID].ratingInfo.unavialSla = _unavialSla;
209+
}
210+
211+
212+
171213
// Cummulative Order actions. Those are in fact only helpers.
172214
function Write(
173215
OrderType _orderType,
@@ -251,6 +293,22 @@ contract Orders is Administratable {
251293
);
252294
}
253295

296+
function GetOrderratingInfo(uint orderID) public view
297+
returns (
298+
uint counterpartyRating,
299+
uint supplierVolume,
300+
uint workerRating,
301+
uint unavialSla
302+
){
303+
RatingInfo memory rInfo = orders[orderID].ratingInfo;
304+
return (
305+
rInfo.counterpartyRating,
306+
rInfo.supplierVolume,
307+
rInfo.workerRating,
308+
rInfo.unavialSla
309+
);
310+
}
311+
254312
// ordersAmount accessors. Generally setter should not be used, but let it be here just in case.
255313
function GetOrdersAmount() public view returns (uint) {
256314
return ordersAmount;

0 commit comments

Comments
 (0)