-
Notifications
You must be signed in to change notification settings - Fork 20
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: Add Oneblock 3 assertions #2109
Conversation
} | ||
} | ||
|
||
fn fetch_data_from_notion(course_type: &OneBlockCourseType) -> Result<OneBlockResponse> { |
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.
Have you considered creating notion data provider?
|
||
#[derive(Serialize, Deserialize, Debug)] | ||
#[serde(rename_all = "camelCase")] | ||
pub struct OneBlockResponse { |
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.
Why we need such wrap?
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.
You mean oneblock
folder?
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.
Struct, why don't use serde_json::Value
istead, it's flatted anyway.
headers.insert("Notion-Version", "2022-06-28"); | ||
headers.insert( | ||
AUTHORIZATION.as_str(), | ||
GLOBAL_DATA_PROVIDER_CONFIG.read().unwrap().oneblock_notion_key.clone().as_str(), |
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.
Have you considered using try_read
? This should not panic.
"credential_endpoint": "wss://tee-staging.litentry.io" | ||
"credential_endpoint": "wss://tee-staging.litentry.io", | ||
"oneblock_notion_key": "ABCDEFGHIJKLMNOPQRSTUVWXYZ", | ||
"oneblock_notion_url": "https://abc.com" |
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.
Can we have real url
value here?
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.
The logic looks ok in general, thanks :)
|
||
// For Oneblock | ||
Oneblock(OneBlockCourseType), |
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.
Hmm we have somehow interleaved types:
A13,
A14,
Achainable,
A20,
Oneblock,
...
An argument is tho, to make the codec backwards compatible, so we always add items to the bottom of the enum
OneBlockCourseType::CourseParticipation => { | ||
let text = self.get_watch_progress(columns); | ||
ONEBLOCK_COURSES_CONTENT[5] == text |
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.
It seems we are checking if the student watched the last lesson - is it intended? I'm just double checking it because of the name Participation
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.
Yes, the Ruleset is if data is "第六课", assertion valid; if data is "第一课"~"第五课", assertion invalid;
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.
LGTM.
* one block * add 3 credential template * update infos * update codes * update oneblock notion data logic * need to search all linked addresses * add comments * add config file * support all substrate network * add copyright header * rename closure * update handle_stf_call_request * using new entity name * anonymize data * update assertion result * set notion config * using all_substrate_web3networks * make fmt --------- Co-authored-by: songzhouran <songzhouran@gmail.com>
* one block * add 3 credential template * update infos * update codes * update oneblock notion data logic * need to search all linked addresses * add comments * add config file * support all substrate network * add copyright header * rename closure * update handle_stf_call_request * using new entity name * anonymize data * update assertion result * set notion config * using all_substrate_web3networks * make fmt --------- Co-authored-by: songzhouran <songzhouran@gmail.com>
fix #2067
This PR implements almost all the functions, but as the final data has not been confirmed yet, there are still some details to be improved. I think it can be reviewed now. The remaining details can be updated by submitting a new PR after these data are confirmed.
The information that needs to be confirmed includes:
2. What data content is used to represent the three types of VC in the notion table(confirmed, and update code)Assertion examples