-
Notifications
You must be signed in to change notification settings - Fork 373
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(examples): forms #2604
base: master
Are you sure you want to change the base?
feat(examples): forms #2604
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #2604 +/- ##
==========================================
- Coverage 60.15% 60.15% -0.01%
==========================================
Files 561 561
Lines 74999 74999
==========================================
- Hits 45117 45113 -4
- Misses 26505 26507 +2
- Partials 3377 3379 +2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this PR! I've left some comments, try to address them 🙏
Co-authored-by: Leon Hudak <[email protected]>
Co-authored-by: Leon Hudak <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sgtm (after formatting the markdown table)
Co-authored-by: Guilhem Fanton <[email protected]>
Co-authored-by: Guilhem Fanton <[email protected]>
Removed the "review team" label because this is already reviewed by core devs. |
type times struct { | ||
openAt *time.Time | ||
closeAt *time.Time | ||
} | ||
|
||
func parseDates(openAt string, closeAt string) (times, error) { | ||
var openAtTime, closeAtTime *time.Time | ||
|
||
const dateFormat = "2006-01-02T15:04:05Z" | ||
|
||
// Parse openAt if it's not empty | ||
if openAt != "" { | ||
res, err := time.Parse(dateFormat, openAt) | ||
if err != nil { | ||
return times{}, errInvalidDate | ||
} | ||
openAtTime = &res | ||
} | ||
|
||
// Parse closeAt if it's not empty | ||
if closeAt != "" { | ||
res, err := time.Parse(dateFormat, closeAt) | ||
if err != nil { | ||
return times{}, errInvalidDate | ||
} | ||
closeAtTime = &res | ||
} | ||
|
||
return times{openAtTime, closeAtTime}, nil | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- this(
times
) seems to be a redundant design; - using time.Time directly (without a pointer) is perfectly fine.
@leohhhn
As part of the student contributor program, I attempted to create a new example realm that allows the creation and submission of forms on gno !
Features
CreateForm(...)
SubmitForm(...)
GetForms(...), GetFormByID(...), GetAnswer(...)
Field Types
The system supports the following field types:
{"label": "Name", "fieldType": "string", "required": true}
{"label": "Age", "fieldType": "number", "required": true}
{"label": "Is Student?", "fieldType": "boolean", "required": false}
Demo
The external repo where the initial development took place and where you can find the frontend is here.
The web app itself is hosted here
And the most recent test4 version of the contract is forms2
Screenshots :
gnoweb Render()
a form response in the web interface
creating a form in the web interface
Contributors' checklist...
BREAKING CHANGE: xxx
message was included in the description