Skip to content

Commit

Permalink
fix(challenge): fix hint requirements invalid default value
Browse files Browse the repository at this point in the history
  • Loading branch information
pandatix committed Apr 2, 2024
1 parent a241761 commit c7823ca
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions provider/challenge/hint_subresource.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ func HintSubresourceAttributes() map[string]schema.Attribute {
"requirements": schema.ListAttribute{
MarkdownDescription: "Other hints required to be consumed before getting this one. Useful for cost-increasing hint strategies with more and more help.",
ElementType: types.StringType,
Default: listdefault.StaticValue(basetypes.ListValue{}),
Computed: true,
Optional: true,
Default: listdefault.StaticValue(basetypes.NewListValueMust(types.StringType, []attr.Value{})),
},
}
}
Expand Down Expand Up @@ -111,11 +111,6 @@ func (data *HintSubresourceModel) Update(ctx context.Context, diags diag.Diagnos

data.Content = types.StringValue(*res.Content)
data.Cost = types.Int64Value(int64(res.Cost))
dPreq := make([]attr.Value, 0, len(res.Requirements.Prerequisites))
for _, resPreq := range res.Requirements.Prerequisites {
dPreq = append(dPreq, types.StringValue(strconv.Itoa(resPreq)))
}
data.Requirements = types.ListValueMust(types.StringType, dPreq)
}

func (data *HintSubresourceModel) Delete(ctx context.Context, diags diag.Diagnostics, client *api.Client) {
Expand Down

0 comments on commit c7823ca

Please sign in to comment.