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

Update descendingFilter.js #16

Merged

Conversation

ChuckTerry
Copy link
Contributor

Fixes #11
Adds logic for "future" date sorting to reduce the chance of qualifications from previous years showing at the top. I can take this further in the future and actually parse the JSON source to get exact dates to eliminate the problem altogether.

I tested this only to ensure it loaded correctly. I haven't been on the platform quite as long. Would you mind testing it out on your account to ensure it sorts correctly?

Logic for "future" date sorting
@john-tettis
Copy link
Owner

Tested locally, works perfectly. Only issue I can foresee is qualifications that are older than year being recycled. For example, come november, that old qual(if it is still there) will be pushed back to the top. But I doubt a qual will last that long..

@john-tettis john-tettis merged commit 19d7984 into john-tettis:master Aug 14, 2024
@ChuckTerry
Copy link
Contributor Author

Tested locally, works perfectly. Only issue I can foresee is qualifications that are older than year being recycled. For example, come november, that old qual(if it is still there) will be pushed back to the top. But I doubt a qual will last that long..

I'm already working on it :D it's just gonna require a decent bit of logic reworking. Here's code that adds an invisible year span to every date cell in the projects and qualifications table:

(() => {
	const rows = new Map([...document.querySelectorAll('tr')].map((element) => {
		return [element.firstChild.innerText, element];
	}));
	
	JSON.parse(document.querySelector("#main > div").dataset.reactProps).dashboardMerchTargeting.projects.map((project) => {
		const name = project.name;
		if (rows.has(project.name)) {
			const row = rows.get(name);
			const dateCell = row.children[3];
			const cellText = dateCell.innerText;
			const year = project.created.split('-')[0];
			const span = document.createElement('span');
			span.style.display = 'none';
			span.innerText = ` ${year}`;
			dateCell.append(span);
		}
	});
})();

@ChuckTerry ChuckTerry deleted the qualification-future-date-fix branch August 15, 2024 05:44
@ChuckTerry ChuckTerry mentioned this pull request Aug 15, 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.

Qualification Sort Issue
2 participants