TreatmentInfusion.qml

Clone Tools
  • last updated a few minutes ago
Constraints
Constraints: committers
 
Constraints: files
Constraints: dates
RESOLVED

RESOLVED

UI-DEN-2795_UIHeparinBolus(UITreatmentScreenAssets)
UI-DEN-2795_UIHeparinBolus(UITreatmentScreenAssets)
DEN-2795 : UI Heparin Bolus (UI Treatment Screen Assets)

__________________________________________________________________________________

Behrouz NematiPour

bNematiPour@diality.com

  1. … 11 more files in changeset.
Hey Peter, Thanks for the comments and all the testing . This function doesn't mean to be used the way you tested it. But anyway I came up with a better solution. def partition(vString, vPart, vRig...

Hey Peter,
Thanks for the comments and all the testing .
This function doesn't mean to be used the way you tested it.
But anyway I came up with a better solution.

def partition(vString, vPart, vRightDirection=True):
    return [vString[i: i + vPart] for i in range(0, len(vString), vPart)][::-1 if vRightDirection else 1]

Actually my first thought was not correct on how this portion of the code should work.

RESOLVED

RESOLVED

Resolving as per our conv. today regarding placeholders

Resolving as per our conv. today regarding placeholders

def partition_orig(vString, vPart, vRightDirection = True): if vRightDirection: list = [vString[i - vPart : i] for i in range(len(vString), 0, -vPart)] else: list = [vStrin...

def partition_orig(vString, vPart, vRightDirection = True):
    if vRightDirection:
        list = [vString[i - vPart : i] for i in range(len(vString), 0, -vPart)]
    else:
        list = [vString[i : i + vPart] for i in range(0, len(vString), vPart)]
    return list


def partition_2(vString, vPart, vRightDirection = True):
    if vRightDirection:
        vString = vString[::-1]
    return [vString[i : i + vPart][::-1] for i in range(0, len(vString), vPart)]

print(partition_orig("TESTING123", 3))
print(partition_2("TESTING123", 3))

                  


Outputs:

['123', 'ING', 'EST', '']
['123', 'ING', 'EST', 'T']


whereas

def partition_2(vString, vPart, vRightDirection = True):
    if vRightDirection:
        vString = vString[::-1]
    return [vString[i : i + vPart] for i in range(0, len(vString), vPart)]


outputs

['321', 'GNI', 'TSE', 'T']


I think you're saying you want to do the second one right? I think that would be better too!

Edit: Also I don't think you need the mString because in python immutable types (e.g. string, number, tuple) behave like call by value

I came out with the solution below : def partition1(vString, vPart, vRightDirection=True): mString = vString if vRightDirection: mString = vString[::-1] else: mString = vString list = [mString[i: ...

I came out with the solution below :

def partition1(vString, vPart, vRightDirection=True):
mString = vString
if vRightDirection:
mString = vString[::-1]
else:
mString = vString
list = [mString[i: i + vPart] for i in range(0, len(mString), vPart)]
return list

if _name_ == "_main_":
vString = "TESTING"
vPart = 3

list = partition1(vString, vPart, True)
print(list)


list = partition1(vString, vPart, False)
print(list)

// ----- Output ----- :
['GNI', 'TSE', 'T']
['TES', 'TIN', 'G']

which is exactly what I want.
I'm gonna push changes if you agree.

Thank you so much Peter. This is exactly the kind of code review I really like. I looked at the code you sent and tried to test it. At a first glance I saw a misbehavior. your code is partition2. ...

Thank you so much Peter.
This is exactly the kind of code review I really like.
I looked at the code you sent and tried to test it.
At a first glance I saw a misbehavior.

your code is partition2.
list = partition2("TESTING", 2, False)
print(list)

list = partition("TESTING", 2, False)
print(list)
// —
The output is different :
['ET', 'TS', 'NI', 'G'] partition2
['TE', 'ST', 'IN', 'G'] partition

so the output is unexpected.

partition("TESTING123", 3) will return ['123', 'ING', 'EST', ''] which is missing a character. Also, partition("TESTING123", 12) returns ['23'] which isn't right. How about: def...
 partition("TESTING123", 3) 


will return

['123', 'ING', 'EST', ''] 


which is missing a character.

Also,

 partition("TESTING123", 12) 


returns

 ['23'] 


which isn't right.

How about:

def partition(vString, vPart, vRightDirection = True):
	if vRightDirection:
		vString = vString[::-1]
	return [vString[i : i + vPart][::-1] for i in range(0, len(vString), vPart)]

RESOLVED

RESOLVED

RESOLVED

RESOLVED

Hey, yes this can be resolved. When I first looked over the change, I misread it and thought you were doing a static_cast<QVariant::Type>(vData) instead of static_cast<QVariant::Type>(QMetaType::Fl...

Hey, yes this can be resolved. When I first looked over the change, I misread it and thought you were doing a static_cast<QVariant::Type>(vData) instead of static_cast<QVariant::Type>(QMetaType::Float), which gave me pause. Since that's not the case, this change looks good to me

OK, I made the changes. I found the point of confusion. The code in this branch is 2-3 weeks older than latest code. after doing the changes and merge I found out what is the point of the confusion...

OK, I made the changes.
I found the point of confusion.
The code in this branch is 2-3 weeks older than latest code. after doing the changes and merge I found out what is the point of the confusion.
I modified the code anyway.

Please resolve the comment as well. Also a good reference for later: http://www.cplusplus.com/doc/tutorial/typecasting/

Please resolve the comment as well.
Also a good reference for later:
http://www.cplusplus.com/doc/tutorial/typecasting/

RESOLVED

RESOLVED

I don't know why I should use dynamic_cast and have an if around the cast. What is the point? What do I gain by doing so? I'm sure checking everything in compile time is much more safer than in run...

I don't know why I should use dynamic_cast and have an if around the cast. What is the point?
What do I gain by doing so?
I'm sure checking everything in compile time is much more safer than in run-time waiting for the code to be executed and then handle the exception.
What is the advantage of the dynamic_cast over the static_cast. they do the same thing if can successfully doing it in different situation.

Don't we not know the true type of vData even at runtime? So, what is the advantage of static_cast being used if it only checks the type at compile time? With dynamic_cast doesn't it return null if...

Don't we not know the true type of vData even at runtime? So, what is the advantage of static_cast being used if it only checks the type at compile time?
With dynamic_cast doesn't it return null if it doesn't contain the type casted, so you just add an if statement checking whether it is null or not to know for a fact that you're cast was successful

Wait so in that case mData would be written over with the call: Types::setValue(s32, mData) Then mData is returned, with a length of one. Would the caller know whether the value was correctly conve...

Wait so in that case mData would be written over with the call: Types::setValue(s32, mData)
Then mData is returned, with a length of one.
Would the caller know whether the value was correctly converted to 0, or converted to 0 in error in this case?

RESOLVED.

RESOLVED.

RESOLVED.

RESOLVED.

RESOLVED.

RESOLVED.