-
Notifications
You must be signed in to change notification settings - Fork 44
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
Edit button #33
Edit button #33
Conversation
src/pages/Session.tsx
Outdated
}); | ||
console.log(props.FormData.test.id); |
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.
remove later
}, | ||
}; | ||
} else if (type === "edit" && sessionId) { | ||
const FormData = await getASession(Number(sessionId)); |
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 are you doing getASession when that session data is already there with you ? why the additional instance.get() request
when you are "editing" a session, you already have that session data!
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.
I want to get the data for the session with the particular id
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.
but its already there. why get again?
src/pages/api/PostFormData.ts
Outdated
platform: test.platform, | ||
platform_link: "", | ||
portal_link: "", //responds to the portal link | ||
name: test.name, //x |
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.
remove these //x
comments. maybe copy paste elsewhere.
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.
removed
src/pages/api/UpdateFormData.ts
Outdated
import type { NextApiRequest, NextApiResponse } from "next"; | ||
|
||
/* | ||
async function formatDateTime(date: string, time: string) { |
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.
if its commented out, just remove it
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.
removed it
src/pages/api/UpdateFormData.ts
Outdated
} | ||
*/ | ||
|
||
async function formatDateTime(date: string, time: string) { |
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 code is already there in PostFormData ?
maybe you can have a "single" file for both PostFormData and UpdateFormData since there's so much similarity. avoid unnecessary code repetition
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.
merged into a single file
src/pages/api/UpdateFormData.ts
Outdated
sessionId: string | ||
) { | ||
const { student, test, timeline, session } = formData; | ||
console.log(sessionId); |
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.
remove later
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.
removed
src/pages/api/UpdateFormData.ts
Outdated
...(test.optionalLimit ? { optional_limits: test.optionalLimit } : {}), | ||
...(test.markingScheme ? { marking_scheme: test.markingScheme } : {}), | ||
...(test.type ? { test_type: test.type } : {}), | ||
date_created: new Date().toISOString().split("T")[0], |
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? this would then get updated to current time.
its date_created
.. not date_updated
-- it is not supposed to change.
src/pages/api/UpdateFormData.ts
Outdated
}; | ||
|
||
if (student || test || timeline) { | ||
patchBody.meta_data = { |
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.
where is shortened link? please check and ensure everything is there in metadata
return date.toISOString().split("T")[1].slice(0, 5); // Extracts the time part | ||
} | ||
|
||
async function getASession(id: number) { |
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.
i feel this is unnecessary. have the function of course. but don't use it yet. its not needed for edit i feel
src/utils/PublishSnsMessage.ts
Outdated
@@ -7,7 +7,7 @@ AWS.config.update({ | |||
}); | |||
|
|||
const sns = new AWS.SNS(); | |||
function publishMessage(sessionId) { | |||
export function publishMessage(sessionId: string) { |
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.
publish message type is wrong.. it doesn't just take session id. it actually takes in a message object with a more involved structure.
the message object has: [action, id, patch_session] keys as of now. you can put this in types.
i am getting compilation error when i'm trying out on local
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.
resolved now
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.
left comments. link of deployment: https://editbutton.dauyvuo7dvzau.amplifyapp.com/
this will work once you resolve some type errors
src/pages/api/PostFormData.ts
Outdated
cms_test_id: | ||
// "https://cms.peerlearning.com/chapter_tests/655df9a23562d97a6300b53e", | ||
test.cmsId, | ||
test.cmsId, //x |
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.
remove //x
src/pages/api/PostFormData.ts
Outdated
test_takers_count: student.testTakers, | ||
has_synced_to_bq: false, | ||
optional_limits: test.optionalLimit, | ||
marking_scheme: test.markingScheme, | ||
test_type: test.type, | ||
shortened_link: "", | ||
report_link: "", | ||
date_created: new Date().toISOString().split("T")[0], | ||
date_created: new Date().toISOString().split("T")[0], //x |
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.
remove //x
src/pages/api/PostFormData.ts
Outdated
...(test.markingScheme ? { marking_scheme: test.markingScheme } : {}), | ||
...(test.type ? { test_type: test.type } : {}), | ||
...(test.shortened_link ? { test_type: test.shortened_link } : {}), | ||
date_created: timeline.date_created, |
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.
what is timeline.date_created ? date_created is in metadata
Summary
This PR aims to add the delete functionality for quiz creator for editing sessions
Local Language Supportdocs/ENV.md
,.env.example
and the Github workflows.alt
attributes<img>
tags havewidth
andheight
specifiedtarget="_blank"
links haverel="noopener"
aria-label
attributes set