Skip to content
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

ledger #316

Closed
wants to merge 0 commits into from
Closed

ledger #316

wants to merge 0 commits into from

Conversation

Falilah
Copy link
Contributor

@Falilah Falilah commented Dec 12, 2024

Closes #196

Copy link

Hello 👋 Thanks for your PR.

This repo does not currently have dedicated maintainers. Our cross-track maintainers team will attempt to review and merge your PR, but it will likely take longer for your PR to be reviewed.

If you enjoy contributing to Exercism and have a track-record of doing so successfully, you might like to become an Exercism maintainer for this track.

Please feel free to ask any questions, or chat to us about anything to do with this PR or the reviewing process on the Exercism forum.

(cc @exercism/cross-track-maintainers)

Copy link
Contributor

@0xNeshi 0xNeshi left a comment

Choose a reason for hiding this comment

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

Did a first iteration, good job!

exercises/practice/ledger/tests/ledger.cairo Outdated Show resolved Hide resolved
exercises/practice/ledger/tests/ledger.cairo Outdated Show resolved Hide resolved
let currency = Currency::USD;
let locale = Locale::en_US;
let entries = array![
("2015-01-01", "Buy present", "-1000"), ("2015-01-02", "Get present", "1000")
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
("2015-01-01", "Buy present", "-1000"), ("2015-01-02", "Get present", "1000")
("2015-01-02", "Get present", "1000"), ("2015-01-01", "Buy present", "-1000"),

These entries should be switched

let entries = array![
("2015-01-01", "Something", "-1"),
("2015-01-01", "Something", "0"),
("2015-01-01", "Something", "1")
Copy link
Contributor

Choose a reason for hiding this comment

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

Place entries in the correct order

exercises/practice/ledger/tests/ledger.cairo Outdated Show resolved Hide resolved
exercises/practice/ledger/.meta/example.cairo Outdated Show resolved Hide resolved
// Format the date based on the locale
let formatted_date = format_date(@date, @locale);

// Format the change based on the currency and locale
Copy link
Contributor

Choose a reason for hiding this comment

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

Move this comment above the function definition


// Step 2: Process transactions
for (
date, transaction, change
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
date, transaction, change
date, description, amount_in_cents

as per canonical data, the names are much clearer now

(year, month, day)
}

fn format_change(change: @ByteArray, currency: @Currency, locale: @Locale) -> ByteArray {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
fn format_change(change: @ByteArray, currency: @Currency, locale: @Locale) -> ByteArray {
fn format_amount(amount_in_cents: @ByteArray, currency: @Currency, locale: @Locale) -> ByteArray {

exercises/practice/ledger/.meta/example.cairo Outdated Show resolved Hide resolved
exercises/practice/ledger/.meta/example.cairo Outdated Show resolved Hide resolved
exercises/practice/ledger/.meta/example.cairo Outdated Show resolved Hide resolved
exercises/practice/ledger/.meta/example.cairo Outdated Show resolved Hide resolved
exercises/practice/ledger/.meta/example.cairo Outdated Show resolved Hide resolved
@0xNeshi
Copy link
Contributor

0xNeshi commented Dec 22, 2024

@Falilah what happened, why did you close the PR? 😮

@Falilah
Copy link
Contributor Author

Falilah commented Dec 22, 2024

I was having conflicts issue, so I did git rebase and all my work cleared, I am trying to bring them up by writing it back.
I actually did not know it will affect all the work that has not been merged.
I am so sorry.

@0xNeshi
Copy link
Contributor

0xNeshi commented Dec 22, 2024

Ah, no problem! It happens, and it's frustrating every time it does...

Once you revert everything, feel free to reopen the PR, I'll get a notification

@0xNeshi 0xNeshi mentioned this pull request Dec 25, 2024
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.

Add Practice Exercise: ledger
2 participants