Skip to content

get allocatad proposals as well#6

Open
Eb-Zeero wants to merge 16 commits into
developfrom
allocated-proposals
Open

get allocatad proposals as well#6
Eb-Zeero wants to merge 16 commits into
developfrom
allocated-proposals

Conversation

@Eb-Zeero
Copy link
Copy Markdown
Collaborator

@Eb-Zeero Eb-Zeero commented May 14, 2020

This change is Reviewable

Copy link
Copy Markdown
Contributor

@hettlage hettlage left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 0 of 1 files reviewed, 7 unresolved discussions (waiting on @Eb-Zeero)


app/graphql/schema.py, line 94 at r1 (raw file):

def find_proposals_allocated_time(params, filters):

find_proposals_allocated ---> find_proposals_with_time_allocation


app/graphql/schema.py, line 96 at r1 (raw file):

def find_proposals_allocated_time(params, filters):
    allocated_time_sql = """
SELECT DISTINCT Proposal_Code

Don't you have to check that the allocated time is greater than 0?


app/graphql/schema.py, line 103 at r1 (raw file):

    JOIN ProposalCode USING (ProposalCode_Id)
WHERE {where}
    """.format(where=" AND ".join(filters))

You probably should add parentheses, in case there is an OR in one of the filters:

where = "(" + ") AND (".join(filters) + ")"


app/graphql/schema.py, line 108 at r1 (raw file):

def find_proposals_submitted(params, filters):

find_proposals_submitted ---> find_submitted_proposals


app/graphql/schema.py, line 120 at r1 (raw file):

    JOIN Partner AS partner ON (MultiPartner.Partner_Id = partner.Partner_Id)
WHERE {where}
    """.format(where=" AND ".join(filters))

You probably should add parentheses, in case there is an OR in one of the filters:

where = "(" + ") AND (".join(filters) + ")"


app/graphql/schema.py, line 213 at r1 (raw file):

            params["semester"] = semester.semester

        df_of_proposals_allocated_time = find_proposals_allocated_time(params, filters)

I would omit the "of".


app/graphql/schema.py, line 214 at r1 (raw file):

        df_of_proposals_allocated_time = find_proposals_allocated_time(params, filters)
        df_of_proposals_submitted = find_proposals_submitted(params, filters)

I would omit the "of".

Copy link
Copy Markdown
Contributor

@hettlage hettlage left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 of 1 files at r1.
Reviewable status: all files reviewed, 7 unresolved discussions (waiting on @Eb-Zeero)

Copy link
Copy Markdown
Collaborator Author

@Eb-Zeero Eb-Zeero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 0 of 1 files reviewed, 7 unresolved discussions (waiting on @hettlage)


app/graphql/schema.py, line 94 at r1 (raw file):

Previously, hettlage wrote…

find_proposals_allocated ---> find_proposals_with_time_allocation

Done.


app/graphql/schema.py, line 96 at r1 (raw file):

Previously, hettlage wrote…

Don't you have to check that the allocated time is greater than 0?

query will return all 4 allcation bu only need one proposal code so just one code will be returned


app/graphql/schema.py, line 103 at r1 (raw file):

Previously, hettlage wrote…

You probably should add parentheses, in case there is an OR in one of the filters:

where = "(" + ") AND (".join(filters) + ")"

there will never be an OR
it is only a semester or partner.
but this gets intersting coz both can be null will fix that part.


app/graphql/schema.py, line 108 at r1 (raw file):

Previously, hettlage wrote…

find_proposals_submitted ---> find_submitted_proposals

Done.


app/graphql/schema.py, line 120 at r1 (raw file):

Previously, hettlage wrote…

You probably should add parentheses, in case there is an OR in one of the filters:

where = "(" + ") AND (".join(filters) + ")"

therre will be an OR it is partner and semester


app/graphql/schema.py, line 213 at r1 (raw file):

Previously, hettlage wrote…

I would omit the "of".

Done.


app/graphql/schema.py, line 214 at r1 (raw file):

Previously, hettlage wrote…

I would omit the "of".

Done.

Copy link
Copy Markdown
Contributor

@hettlage hettlage left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 of 1 files at r2.
Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @Eb-Zeero)


app/graphql/schema.py, line 96 at r1 (raw file):

Previously, Eb-Zeero (Nhlavutelo Macebele) wrote…

query will return all 4 allcation bu only need one proposal code so just one code will be returned

But what if all four allocations are 0?


app/graphql/schema.py, line 103 at r1 (raw file):

Previously, Eb-Zeero (Nhlavutelo Macebele) wrote…

there will never be an OR
it is only a semester or partner.
but this gets intersting coz both can be null will fix that part.

I beg to differ. The function takes any filters, so someone might be using it with an OR condition.


app/graphql/schema.py, line 108 at r1 (raw file):

Previously, Eb-Zeero (Nhlavutelo Macebele) wrote…

Done.

I don't see a change? :)


app/graphql/schema.py, line 120 at r1 (raw file):

Previously, Eb-Zeero (Nhlavutelo Macebele) wrote…

therre will be an OR it is partner and semester

My above concern applies here as well.

Copy link
Copy Markdown
Collaborator Author

@Eb-Zeero Eb-Zeero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 0 of 1 files reviewed, 4 unresolved discussions (waiting on @hettlage)


app/graphql/schema.py, line 96 at r1 (raw file):

Previously, hettlage wrote…

But what if all four allocations are 0?

then that proposal is submitted I need it


app/graphql/schema.py, line 103 at r1 (raw file):

Previously, hettlage wrote…

I beg to differ. The function takes any filters, so someone might be using it with an OR condition.

Done.


app/graphql/schema.py, line 120 at r1 (raw file):

Previously, hettlage wrote…

My above concern applies here as well.

Done.

Copy link
Copy Markdown
Contributor

@hettlage hettlage left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 of 1 files at r3.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @Eb-Zeero)


app/graphql/schema.py, line 108 at r3 (raw file):

def find_submitted_proposals(params, filters):

find_submitted_proposals ---> find_proposals_with_time_requests

Copy link
Copy Markdown
Collaborator Author

@Eb-Zeero Eb-Zeero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @hettlage)


app/graphql/schema.py, line 108 at r3 (raw file):

Previously, hettlage wrote…

find_submitted_proposals ---> find_proposals_with_time_requests

Done.

Copy link
Copy Markdown
Contributor

@hettlage hettlage left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 of 1 files at r5, 2 of 2 files at r6.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @Eb-Zeero)


app/graphql/schema.py, line 108 at r5 (raw file):

def find_proposals_with_time_requests(params, filters):

You should add a docstring pointing out that a proposal is included if the time request is for 0 seconds.

I think rather than passing filters it would make more sense to pass partners and semester (the same is true for find_proposals_with_time_allocation).


app/graphql/schema.py, line 117 at r6 (raw file):

    JOIN ProposalStatus USING (ProposalStatus_Id)
    JOIN MultiPartner USING(ProposalCode_Id)
    JOIN Semester AS s ON MultiPartner.Semester_Id=s.Semester_Id

As no alias is used for any other table, you arguably shouldn't use an alias for Semester.

Copy link
Copy Markdown
Collaborator Author

@Eb-Zeero Eb-Zeero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 1 of 2 files reviewed, 2 unresolved discussions (waiting on @hettlage)


app/graphql/schema.py, line 108 at r5 (raw file):

Previously, hettlage wrote…

You should add a docstring pointing out that a proposal is included if the time request is for 0 seconds.

I think rather than passing filters it would make more sense to pass partners and semester (the same is true for find_proposals_with_time_allocation).

Done.


app/graphql/schema.py, line 117 at r6 (raw file):

Previously, hettlage wrote…

As no alias is used for any other table, you arguably shouldn't use an alias for Semester.

Done.

Copy link
Copy Markdown
Contributor

@hettlage hettlage left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 1 of 2 files reviewed, 2 unresolved discussions (waiting on @Eb-Zeero and @hettlage)


app/graphql/schema.py, line 124 at r7 (raw file):

def find_proposals_with_time_requests(params, filters):

Can we have a chat about filters and parameters?


app/graphql/schema.py, line 126 at r7 (raw file):

def find_proposals_with_time_requests(params, filters):
    """
    All of the proposal that are requesting time.

All the proposals that are requesting time.

Copy link
Copy Markdown
Contributor

@hettlage hettlage left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 of 1 files at r7.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @Eb-Zeero)

Copy link
Copy Markdown
Contributor

@hettlage hettlage left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 of 1 files at r8.
Reviewable status: all files reviewed, 11 unresolved discussions (waiting on @Eb-Zeero)


app/graphql/schema.py, line 101 at r8 (raw file):

    ----------
    partner_code : str
        The partner Code such as "RSA". The partner code can be None for all partners

The partner code, such as "RSA". If the proposal code is None, proposals are returned for all partners.


app/graphql/schema.py, line 102 at r8 (raw file):

    partner_code : str
        The partner Code such as "RSA". The partner code can be None for all partners
    semester : str

Isn't the semester an object?


app/graphql/schema.py, line 103 at r8 (raw file):

        The partner Code such as "RSA". The partner code can be None for all partners
    semester : str
        The semester like "2020-1".

The semester. If semester is None, proposals are returned for all semesters.

[I omitted the "such as" part, as it would suggest that you have to pass the semester as a string.]


app/graphql/schema.py, line 107 at r8 (raw file):

    Returns
    -------
    Proposal Code : DataFrame

Proposal Code : DataFrame ---> DataFrame


app/graphql/schema.py, line 111 at r8 (raw file):

    """
    # get the filter conditions

Empty line missing after """.


app/graphql/schema.py, line 142 at r8 (raw file):

    ----------
    partner_code : str
        The partner Code such as "RSA". The partner code can be None for all partners

The partner code, such as "RSA". If the proposal code is None, proposals are returned for all partners.


app/graphql/schema.py, line 143 at r8 (raw file):

    partner_code : str
        The partner Code such as "RSA". The partner code can be None for all partners
    semester : str

Isn't the semester an object?


app/graphql/schema.py, line 144 at r8 (raw file):

        The partner Code such as "RSA". The partner code can be None for all partners
    semester : str
        The semester like "2020-1".

The semester. If semester is None, proposals are returned for all semesters.

[I omitted the "such as" part, as it would suggest that you have to pass the semester as a string.]


app/graphql/schema.py, line 148 at r8 (raw file):

    Returns
    -------
    Proposal Code : DataFrame

Proposal Code: DataFrame ---> DataFrame


app/graphql/schema.py, line 152 at r8 (raw file):

    """
    # get the filter conditions

Empty line missing below """.

Copy link
Copy Markdown
Collaborator Author

@Eb-Zeero Eb-Zeero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: all files reviewed, 11 unresolved discussions (waiting on @hettlage)


app/graphql/schema.py, line 126 at r7 (raw file):

Previously, hettlage wrote…

All the proposals that are requesting time.

Done.


app/graphql/schema.py, line 101 at r8 (raw file):

Previously, hettlage wrote…

The partner code, such as "RSA". If the proposal code is None, proposals are returned for all partners.

Done.


app/graphql/schema.py, line 102 at r8 (raw file):

Previously, hettlage wrote…

Isn't the semester an object?

it is ahh


app/graphql/schema.py, line 103 at r8 (raw file):

Previously, hettlage wrote…

The semester. If semester is None, proposals are returned for all semesters.

[I omitted the "such as" part, as it would suggest that you have to pass the semester as a string.]

Done.


app/graphql/schema.py, line 107 at r8 (raw file):

Previously, hettlage wrote…

Proposal Code : DataFrame ---> DataFrame

Done.


app/graphql/schema.py, line 111 at r8 (raw file):

Previously, hettlage wrote…

Empty line missing after """.

Done.


app/graphql/schema.py, line 142 at r8 (raw file):

Previously, hettlage wrote…

The partner code, such as "RSA". If the proposal code is None, proposals are returned for all partners.

Done.


app/graphql/schema.py, line 143 at r8 (raw file):

Previously, hettlage wrote…

Isn't the semester an object?

Done.


app/graphql/schema.py, line 144 at r8 (raw file):

Previously, hettlage wrote…

The semester. If semester is None, proposals are returned for all semesters.

[I omitted the "such as" part, as it would suggest that you have to pass the semester as a string.]

Done.


app/graphql/schema.py, line 148 at r8 (raw file):

Previously, hettlage wrote…

Proposal Code: DataFrame ---> DataFrame

Done.


app/graphql/schema.py, line 152 at r8 (raw file):

Previously, hettlage wrote…

Empty line missing below """.

Done.

Copy link
Copy Markdown
Contributor

@hettlage hettlage left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 of 1 files at r9.
Reviewable status: all files reviewed, 6 unresolved discussions (waiting on @Eb-Zeero and @hettlage)


app/graphql/schema.py, line 103 at r9 (raw file):

        The partner code, such as "RSA". If the proposal code is None, proposals are returned for all partners.
    semester : semester
        The semester. If semester is None, proposals are returned for all semesters.

If semester ---> If the semester


app/graphql/schema.py, line 138 at r9 (raw file):

def find_proposals_with_time_requests(partner_code, semester):
    """
    All of the proposal that are requesting time.

All of the proposal ---> All the proposals


app/graphql/schema.py, line 145 at r9 (raw file):

        The partner code, such as "RSA". If the proposal code is None, proposals are returned for all partners.
    semester : semester
        The semester. If semester is None, proposals are returned for all semesters.

If semester ---> If the semester

Copy link
Copy Markdown
Collaborator Author

@Eb-Zeero Eb-Zeero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: all files reviewed, 6 unresolved discussions (waiting on @hettlage)


app/graphql/schema.py, line 103 at r9 (raw file):

Previously, hettlage wrote…

If semester ---> If the semester

Done.


app/graphql/schema.py, line 138 at r9 (raw file):

Previously, hettlage wrote…

All of the proposal ---> All the proposals

Done.


app/graphql/schema.py, line 145 at r9 (raw file):

Previously, hettlage wrote…

If semester ---> If the semester

Done.

Copy link
Copy Markdown
Contributor

@hettlage hettlage left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 of 1 files at r10.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @Eb-Zeero and @hettlage)


app/graphql/schema.py, line 204 at r10 (raw file):

    proposal = Field(
        lambda: ProposalF

I guess ProposalF should be Proposal, ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants