Skip to content

Make server timestamp methods static, rename ServerTimestamps #1222

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

Merged
merged 3 commits into from
Feb 7, 2020

Conversation

wilhuff
Copy link
Contributor

@wilhuff wilhuff commented Feb 7, 2020

No description provided.

@codecov
Copy link

codecov bot commented Feb 7, 2020

Codecov Report

Merging #1222 into mrschmidt/rewritefieldvalue will decrease coverage by 0.07%.
The diff coverage is 66.66%.

Flag Coverage Δ Complexity Δ
#FirebaseFirestore 61.86% <66.66%> (-0.08%) 2224 <13> (-2)
#FirebaseFirestore_Ktx 41.17% <ø> (ø) 0 <ø> (ø) ⬇️
Impacted Files Coverage Δ Complexity Δ
...main/java/com/google/firebase/firestore/Query.java 2.93% <0%> (ø) 4 <0> (ø) ⬇️
...le/firebase/firestore/model/value/ObjectValue.java 92.07% <0%> (ø) 21 <0> (ø) ⬇️
...store/model/mutation/ServerTimestampOperation.java 100% <100%> (ø) 5 <1> (ø) ⬇️
...le/firebase/firestore/model/value/ProtoValues.java 90.52% <100%> (-0.39%) 116 <11> (ø)
.../com/google/firebase/firestore/UserDataWriter.java 49.05% <28.57%> (-0.95%) 16 <0> (ø)
...rebase/firestore/model/value/ServerTimestamps.java 70.83% <50%> (ø) 5 <1> (?)
...e/src/main/java/com/google/firebase/Timestamp.java 84.31% <0%> (-1.97%) 19% <0%> (-1%)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bda327b...57314fe. Read the comment docs.

@wilhuff
Copy link
Contributor Author

wilhuff commented Feb 7, 2020

Another alternative would be to fold these into the ProtoValues class.

switch (serverTimestampBehavior) {
case PREVIOUS:
return value.getPreviousValue() == null ? null : convertValue(value.getPreviousValue());
Value previousValue = getPreviousValue(serverTimestampValue);
if (previousValue == null) return null;
Copy link
Contributor

Choose a reason for hiding this comment

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

The Java style guide suggests to use braces even for one line statements: https://engdoc.corp.google.com/eng/doc/devguide/java/style/index.md?cl=head#s4.1-braces

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed. It's lame that Java and C++ don't align on this point.

return !timestampsInSnapshots
? value.getLocalWriteTime().toDate()
: value.getLocalWriteTime();
return convertTimestamp(getLocalWriteTime(serverTimestampValue));
Copy link
Contributor

Choose a reason for hiding this comment

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

:) Much better.

@wilhuff wilhuff merged commit 4864c6a into mrschmidt/rewritefieldvalue Feb 7, 2020
@wilhuff wilhuff deleted the wilhuff/server-timestamps branch February 7, 2020 18:38
@firebase firebase locked and limited conversation to collaborators Mar 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants