Skip to content

Commit

Permalink
Merge pull request #590 from factn/patch/v001_mvp-1_patch2
Browse files Browse the repository at this point in the history
Store the emailAddress typed during foodbox request into RecipientEmailAddress
utunga authored May 19, 2020

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
2 parents 5dbf625 + f976be7 commit 30dd3d6
Showing 6 changed files with 511 additions and 451 deletions.
926 changes: 488 additions & 438 deletions scheme/data.json

Large diffs are not rendered by default.

9 changes: 6 additions & 3 deletions scheme/data.py
Original file line number Diff line number Diff line change
@@ -126,7 +126,7 @@ def create_organization(self, resources):
for i in range(10):
vol = Volunteer(org.uid)
self.ordered_users.append(vol)
org.add_volunteers(vol)
org.add_volunteer(vol)
self.ordered_organizations.append(org)
return org

@@ -170,7 +170,7 @@ def __init__(self, resources):
# inner attributes for easy access
self.ordered_volunteers = []

def add_volunteers(self, vol):
def add_volunteer(self, vol):
self.ordered_volunteers.append(vol)

def _init_resources(self, resources):
@@ -218,6 +218,7 @@ def __init__(self, orgUid):
self.phoneNumber = f.phone_number()
self.photoURL = 'https://via.placeholder.com/150.png?text=User%20Image'
self.displayName = f.name()
self.recipientEmailAddress = f.free_email()
self.location = any_location()
self.organizationUid = orgUid
self.isVolunteer = True
@@ -261,9 +262,11 @@ def __init__(self, creator):
self.volunteerDisplayName = ""
self.volunteerPhoneNumber = ""

self.recipientUid = creator.uid
non_account = f.boolean(chance_of_getting_true=25)
self.recipientUid = None if non_account else creator.uid
self.recipientDisplayName = creator.displayName
self.recipientPhoneNumber = creator.phoneNumber
self.recipientEmailAddress = creator.recipientEmailAddress

self.pickUpWindow = timeWindow()
self.pickUpLocation = any_location()
1 change: 1 addition & 0 deletions src/app/model/Mission.ts
Original file line number Diff line number Diff line change
@@ -54,6 +54,7 @@ const defaultMissionData: MissionInterface = {

recipientDisplayName: "No Recipient Name",
recipientPhoneNumber: "",
recipientEmailAddress: "",
recipientUid: "No Recipient Id", // reference?

pickUpWindow: defaultTimeWindow, // nb this can be an exact time or can be null
9 changes: 7 additions & 2 deletions src/app/model/schema.ts
Original file line number Diff line number Diff line change
@@ -72,13 +72,16 @@ export enum VolunteerStatus {

export class UserInterface {
uid!: string;
/* validated phone number (validated by phone verification challenge) */
phoneNumber?: string;
/* validated email address (validated by google oAuth, currently) */
email?: string;
/* user's selected profile image url
*/
/* user's selected profile image url */
photoURL?: ImageUrl;
/* user profile name, this populate from either user, or his provider*/
displayName?: string;
/* email address user typed in - not validated, can be anything really */
recipientEmailAddress?: string;
/* from the 'Tell us about yourself' form field */
description?: string;
/* user location, we use this to show user on a map */
@@ -99,6 +102,7 @@ export class UserInterface {
hasTransportation: boolean;
/*user volunteering to an organization have a pending status*/
status: VolunteerStatus;
/* notes on the volunteer, by the organizer(s) */
privateNotes: string;
};
/* specific details for the organizer*/
@@ -201,6 +205,7 @@ export interface MissionInterface {
recipientUid: string; // reference?
recipientDisplayName: string;
recipientPhoneNumber: string;
recipientEmailAddress: string;

pickUpWindow: TimeWindow | null; // nb this can be an exact time or can be null
pickUpLocation: Location;
1 change: 1 addition & 0 deletions src/app/page/Request/foodbox/ConfirmStep.jsx
Original file line number Diff line number Diff line change
@@ -68,6 +68,7 @@ function ConfirmStep({ dispatch, state }) {
recipientUid: recipient.uid,
recipientDisplayName: recipient.displayName,
recipientPhoneNumber: recipient.phoneNumber,
recipientEmailAddress: recipient.recipientEmailAddress,
deliveryLocation: details.location,
deliveryNotes: details.instructions,
deliveryType: details.curbsidePickup ? "curbside" : "delivery",
16 changes: 8 additions & 8 deletions src/app/page/Request/foodbox/SignUpStep.jsx
Original file line number Diff line number Diff line change
@@ -17,15 +17,15 @@ export default function SignUpStep({ dispatch, onBack }) {

async function verifyPhone() {
let userUid;
const { cannotReceiveTexts, displayName, emailAddress, phoneNumber } = values;
const { cannotReceiveTexts, displayName, phoneNumber, recipientEmailAddress } = values;

try {
if (cannotReceiveTexts) {
// This user is created but not connected to any login.
userUid = await User.createProfile(null, {
displayName,
phoneNumber,
emailAddress,
recipientEmailAddress,
cannotReceiveTexts: true,
});
} else {
@@ -60,14 +60,14 @@ export default function SignUpStep({ dispatch, onBack }) {
await User.createProfile(userUid, {
displayName,
phoneNumber,
emailAddress,
recipientEmailAddress,
cannotReceiveTexts,
});
}

dispatch({
type: "UPDATE_USER",
payload: { uid: userUid, displayName, phoneNumber, emailAddress },
payload: { uid: userUid, displayName, phoneNumber, recipientEmailAddress },
});
dispatch({ type: "NEXT" });
} catch (error) {
@@ -83,7 +83,7 @@ export default function SignUpStep({ dispatch, onBack }) {
let hasError = false;
hasError = !values.displayName;
hasError = !values.phoneNumber;
hasError = !values.emailAddress;
hasError = !values.recipientEmailAddress;

handleChange({ target: { name: "validate", value: true } });
return hasError;
@@ -119,13 +119,13 @@ export default function SignUpStep({ dispatch, onBack }) {
fullWidth
helperText="We need this to send you information about curbside pickup. We won't share this with anyone."
label="Email Address"
name="emailAddress"
name="recipientEmailAddress"
id="email-address"
onChange={handleChange}
value={values.emailAddress || ""}
value={values.recipientEmailAddress || ""}
variant="outlined"
required
error={values.validate && !values.emailAddress}
error={values.validate && !values.recipientEmailAddress}
/>
<TextField
className={classes.textField}

0 comments on commit 30dd3d6

Please sign in to comment.