Skip to content

Commit

Permalink
feat: update model
Browse files Browse the repository at this point in the history
  • Loading branch information
Utkarsh Dixit committed May 16, 2021
2 parents aef23fa + fdadcee commit a2f4715
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ var token string
var beneficiaries []Beneficiaries
var aptID string
var booked bool
var minAge int
var vaccineName string

func main() {
list := ""
Expand All @@ -44,12 +46,19 @@ func main() {
flag.StringVar(&emailPassword, "password", emailPassword, "Google App Password \ncreate new using https://support.google.com/accounts/answer/185833")
flag.DurationVar(&duration, "interval", duration, "time interval as duration \ne.g. 30s,5m,1h")
flag.StringVar(&mobile, "mobileNumber", "", "10 digit mobile number")
flag.IntVar(&minAge, "minage", 18, "min age group 18 or 45")
flag.StringVar(&vaccineName, "vaccine", "COVISHIELD", "perferred vaccine name\ne.g COVISHIELD or COVAXIN")

flag.Parse()

emailRecipients = strings.Split(list, ",")

if pinCode == "" || emailPassword == "" || emailFrom == "" || len(emailRecipients) < 1 || mobile == "" || len(mobile) == 11 {
if !(strings.Contains(vaccineName, "COVAXIN") || strings.Contains(vaccineName, "COVISHIELD")) {
flag.Usage()
return
}

if pinCode == "" || len(emailRecipients) < 1 || mobile == "" || len(mobile) == 11 {
flag.Usage()
return
}
Expand Down Expand Up @@ -251,7 +260,7 @@ loop:
found := false
for _, c := range slots.Centers {
for _, s := range c.Sessions {
if s.AvailableCapacity > 0 && s.MinAgeLimit < 45 {
if s.AvailableCapacity > 0 && s.MinAgeLimit == minAge {
availableCenters = append(availableCenters, c)
found = true
}
Expand Down

0 comments on commit a2f4715

Please sign in to comment.