Skip to content

Commit

Permalink
mocked getHours for withdraw bounty
Browse files Browse the repository at this point in the history
  • Loading branch information
elraphty committed Oct 18, 2024
1 parent f0bf975 commit fb21888
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
6 changes: 3 additions & 3 deletions db/test_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ var TestDB database

func InitTestDB() {
rdsHost := "localhost"
rdsPort := fmt.Sprintf("%d", 5532)
rdsPort := fmt.Sprintf("%d", 5432)
rdsDbName := "test_db"
rdsUsername := "test_user"
rdsPassword := "test_password"
rdsUsername := "raph"
rdsPassword := "raph"
dbURL := fmt.Sprintf("postgres://%s:%s@%s:%s/%s", rdsUsername, rdsPassword, rdsHost, rdsPort, rdsDbName)

if dbURL == "" {
Expand Down
3 changes: 1 addition & 2 deletions handlers/bounty.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ type bountyHandler struct {
func NewBountyHandler(httpClient HttpClient, database db.Database) *bountyHandler {
dbConf := db.NewDatabaseConfig(&gorm.DB{})
return &bountyHandler{

httpClient: httpClient,
db: database,
getSocketConnections: db.Store.GetSocketConnections,
Expand Down Expand Up @@ -936,7 +935,7 @@ func (h *bountyHandler) BountyBudgetWithdraw(w http.ResponseWriter, r *http.Requ
withdrawCreated := lastWithdrawal.Created
withdrawTime := utils.ConvertTimeToTimestamp(withdrawCreated.String())

hoursDiff := utils.GetHoursDifference(int64(withdrawTime), &now)
hoursDiff := h.getHoursDifference(int64(withdrawTime), &now)

// Check that last withdraw time is greater than 1
if hoursDiff < 1 {
Expand Down

0 comments on commit fb21888

Please sign in to comment.