Ben 1 rok pred
rodič
commit
2136dc3332
1 zmenil súbory, kde vykonal 6 pridanie a 1 odobranie
  1. 6 1
      internal/server/server.go

+ 6 - 1
internal/server/server.go

@@ -28,10 +28,15 @@ func Config(c *gin.Context) {
 	if len(healthNodes()) > 0 {
 	if len(healthNodes()) > 0 {
 		node = healthNodes()[0]
 		node = healthNodes()[0]
 	}
 	}
+	freeTrialDuration := uint64(0)
+	if usedDuration <= totalFreeDuration {
+		freeTrialDuration = totalFreeDuration - usedDuration
+	}
+
 	c.JSON(http.StatusOK, dto.ConfigResponse{
 	c.JSON(http.StatusOK, dto.ConfigResponse{
 		Response: dto.NewOkResponse(),
 		Response: dto.NewOkResponse(),
 		Data: dto.ConfigResult{
 		Data: dto.ConfigResult{
-			FreeTrialDuration: totalFreeDuration - usedDuration,
+			FreeTrialDuration: freeTrialDuration,
 			Timestamp:         time.Now().Unix(),
 			Timestamp:         time.Now().Unix(),
 			Node:              convert2DtoNode(node),
 			Node:              convert2DtoNode(node),
 		},
 		},