message: Fixing compEmissionAmount function
diff: @@ -59,31 +59,6 @@ func (s *EmissionsContract) Invoke(APIstub shim.ChaincodeStubInterface) pb.Respo
  return shim.Error("Invalid Chaincode function name.")
  }
  -/* Compute Emission Amount */
  -
  -func (s *EmissionsContract) compEmissionAmount(APIstub shim.ChaincodeStubInterface, args []string) pb.Response{
  - if len(args) !=1 {
  - return shim.Error("Utility ID is required")
  - }
  -
  - utilityID := args[0]
  - valuesAsBytes, _ := APIstub.GetState(args[0])
  - co2amount := Value{}
  - json.UnMarshal(valuesAsBytes, co2amount)
  -
  - cO2equivalentemissions := args[6]
  - netGeneration := args[7]
  - usage := args[8]
  - usageuOM := args[9]
  - netGenerationuOM := args[10]
  - cO2equivalentemissionsuOM := args[11]
  - emissionsuOM := args[12]
  -
  - var emissionAmount = ((cO2equivalentemissions/netGeneration)*usage*(usageuOM/netGenerationuOM)*(cO2equivalentemissionsuOM/emissionsuOM))
  -
  - return emissionAmount
  -}
  -
  /* InitLegder */
  func (s *EmissionsContract) initLedger(APIstub shim.ChaincodeStubInterface) pb.Response {
  values := []Value{
  @@ -131,6 +106,31 @@ func (s *EmissionsContract) getEmissionRecord(APIstub shim.ChaincodeStubInterfac
  return shim.Success(valuesAsBytes)
  }
  +/* Compute Emission Amount */
  +
  +func (s *EmissionsContract) compEmissionAmount(APIstub shim.ChaincodeStubInterface, args []string) pb.Response{
  + if len(args) !=1 {
  + return shim.Error("Utility ID is required")
  + }
  +
  + utilityID := args[0]
  + valuesAsBytes, _ := APIstub.GetState(args[0])
  + co2amount := Value{}
  + json.UnMarshal(valuesAsBytes, co2amount)
  +
  + cO2equivalentemissions := args[6]
  + netGeneration := args[7]
  + usage := args[8]
  + usageuOM := args[9]
  + netGenerationuOM := args[10]
  + cO2equivalentemissionsuOM := args[11]
  + emissionsuOM := args[12]
  +
  + var emissionAmount = ((cO2equivalentemissions/netGeneration)*usage*(usageuOM/netGenerationuOM)*(cO2equivalentemissionsuOM/emissionsuOM))
  +
  + return emissionAmount
  +}
  +
  /* main function */
  func main() {
  