Skip to content

Commit a394b94

Browse files
committed
fix: old records visible to executive and representative
1 parent 8fa69cb commit a394b94

File tree

13 files changed

+335
-309
lines changed

13 files changed

+335
-309
lines changed

back/routes/activity.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -576,6 +576,7 @@ router.get("/is_report_duration", async (req, res) => {
576576

577577
router.get("/activity_list", async (req, res) => {
578578
const clubId = req.query.club_id;
579+
const isAdvisor = req.query.is_advisor === 1;
579580
const currentDate = new Date();
580581

581582
if (!clubId) {
@@ -621,8 +622,12 @@ router.get("/activity_list", async (req, res) => {
621622
const activities = await Activity.findAll({
622623
where: {
623624
club_id: clubId,
624-
start_date: { [Op.gte]: activityDuration.start_date },
625-
end_date: { [Op.lte]: activityDuration.end_date },
625+
...(isAdvisor
626+
? {
627+
start_date: { [Op.gte]: activityDuration.start_date },
628+
end_date: { [Op.lte]: activityDuration.end_date },
629+
}
630+
: {}),
626631
},
627632
include: [
628633
{
@@ -639,7 +644,7 @@ router.get("/activity_list", async (req, res) => {
639644
"end_date",
640645
"feedback_type",
641646
],
642-
order: [["start_date", "ASC"]],
647+
order: [["recent_edit", "DESC"]],
643648
});
644649

645650
const formatDateString = (date) => {

back/routes/feedback.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,10 @@ router.get("/club_activity_list", async (req, res) => {
8888
const filteredActivities = await Activity.findAll({
8989
where: {
9090
club_id: club_id,
91-
[Sequelize.Op.and]: [
92-
{ start_date: { [Sequelize.Op.gte]: activityDuration.start_date } },
93-
{ end_date: { [Sequelize.Op.lte]: activityDuration.end_date } },
94-
],
91+
// [Sequelize.Op.and]: [
92+
// { start_date: { [Sequelize.Op.gte]: activityDuration.start_date } },
93+
// { end_date: { [Sequelize.Op.lte]: activityDuration.end_date } },
94+
// ],
9595
},
9696
include: [
9797
{
@@ -125,7 +125,7 @@ router.get("/club_activity_list", async (req, res) => {
125125
],
126126
},
127127
],
128-
order: [["feedback_type", "ASC"]],
128+
order: [["recent_edit", "DESC"]],
129129
attributes: [
130130
"id",
131131
"title",

back/routes/funding.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ router.get("/funding_list", async (req, res) => {
5353
const fundings = await Funding.findAll({
5454
where: {
5555
club_id: clubId,
56-
semester_id: currentSemester.id,
56+
// semester_id: currentSemester.id,
5757
},
5858
attributes: [
5959
"id",
@@ -66,8 +66,9 @@ router.get("/funding_list", async (req, res) => {
6666
// Add other required fields
6767
],
6868
order: [
69-
["purpose", "ASC"],
70-
["expenditure_date", "ASC"],
69+
["recent_edit", "DESC"],
70+
// ["purpose", "ASC"],
71+
// ["expenditure_date", "ASC"],
7172
],
7273
});
7374

back/routes/funding_feedback.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ router.get("/club_funding_list", async (req, res) => {
6565
const filteredFundings = await Funding.findAll({
6666
where: {
6767
club_id: club_id,
68-
semester_id: currentSemester.id,
68+
// semester_id: currentSemester.id,
6969
},
7070
include: [
7171
{
@@ -87,7 +87,7 @@ router.get("/club_funding_list", async (req, res) => {
8787
attributes: ["student_id", "name"],
8888
},
8989
],
90-
order: [["funding_feedback_type", "ASC"]],
90+
order: [["recent_edit", "DESC"]],
9191
attributes: [
9292
"id",
9393
"name",
@@ -688,15 +688,12 @@ router.get("/funding_submit_list", async (req, res) => {
688688
);
689689

690690
clubData.sort((a, b) => b.feedbackTypeOne - a.feedbackTypeOne);
691-
const filteredClubData = clubData.filter(
692-
(data) => data.totalClubActivities > 0
693-
);
694691

695692
res.json({
696693
totalActivities,
697694
nonFeedbackTypeOneActivities,
698695
ratio,
699-
clubData: filteredClubData,
696+
clubData: clubData,
700697
});
701698
} catch (error) {
702699
console.error("Error in /activity_submit_list:", error);

front/src/pages/activity/ActivityDetail/ActivityDetail.tsx

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ export const ActivityDetail = (): JSX.Element => {
6060
feedbackResults: [],
6161
});
6262

63+
const minDate = "2023-12-16";
64+
const maxDate = "2024-06-14";
65+
6366
const [searchTerm, setSearchTerm] = useState("");
6467
const [searchResults, setSearchResults] = useState<Participant[]>([]);
6568
const [originalSearchResults, setOriginalSearchResults] = useState<
@@ -401,26 +404,29 @@ export const ActivityDetail = (): JSX.Element => {
401404
</div>
402405
</div>
403406
<UnderBar />
404-
{typeId < 4 && durationStatus > 0 && (
405-
<div className="frame-16">
406-
<div
407-
className="frame-17"
408-
onClick={() => navigate(`/edit_activity/${id}`)}
409-
style={{ cursor: "pointer" }}
410-
>
411-
수정
412-
</div>
413-
{durationStatus == 1 && (
407+
{typeId < 4 &&
408+
durationStatus > 0 &&
409+
minDate <= activity.startDate &&
410+
activity.endDate <= maxDate && (
411+
<div className="frame-16">
414412
<div
415413
className="frame-17"
416-
onClick={handleDeleteActivity}
414+
onClick={() => navigate(`/edit_activity/${id}`)}
417415
style={{ cursor: "pointer" }}
418416
>
419-
삭제
417+
수정
420418
</div>
421-
)}
422-
</div>
423-
)}
419+
{durationStatus == 1 && (
420+
<div
421+
className="frame-17"
422+
onClick={handleDeleteActivity}
423+
style={{ cursor: "pointer" }}
424+
>
425+
삭제
426+
</div>
427+
)}
428+
</div>
429+
)}
424430
</div>
425431
</div>
426432
);

front/src/pages/activity/AddActivity/AddActivity.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ export const AddActivity = (): JSX.Element => {
6868

6969
// Validation for date range and order
7070
//TODO: 서버에서 불러와서 적용
71-
const minDate = new Date("2023-06-17");
72-
const maxDate = new Date("2023-12-15");
71+
const minDate = new Date("2023-12-16");
72+
const maxDate = new Date("2024-06-14");
7373

7474
const handleSearchChange = (e: React.ChangeEvent<HTMLInputElement>) => {
7575
const value = e.target.value;

front/src/pages/activity/EditActivity/EditActivity.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,8 +280,8 @@ export const EditActivity = (): JSX.Element => {
280280
// Validation for date range and order
281281
const startDate = new Date(activity.startDate);
282282
const endDate = new Date(activity.endDate);
283-
const minDate = new Date("2023-06-17");
284-
const maxDate = new Date("2023-12-15");
283+
const minDate = new Date("2023-12-16");
284+
const maxDate = new Date("2024-06-14");
285285

286286
if (
287287
startDate > endDate ||

front/src/pages/admin/ActivityAdminDetail/ActivityAdminDetail.tsx

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@ export const ActivityAdminDetail = (): JSX.Element => {
6161

6262
const [reviewResult, setReviewResult] = useState("");
6363

64+
const minDate = "2023-12-16";
65+
const maxDate = "2024-06-14";
66+
// const maxDate = new Date("2024-06-14");
67+
6468
const handleReviewResultChange = (
6569
event: React.ChangeEvent<HTMLTextAreaElement>
6670
) => {
@@ -241,26 +245,28 @@ export const ActivityAdminDetail = (): JSX.Element => {
241245
))}
242246
</div>
243247
</div>
244-
<div className="frame-11">
245-
<SubTitle className="sub-title-instance" text="검토 결과" />
246-
<div className="frame-9">
247-
<textarea
248-
className="text-area"
249-
value={reviewResult}
250-
onChange={handleReviewResultChange}
251-
/>
252-
<div className="frame-14">
253-
<div
254-
className="frame-15"
255-
style={{ cursor: "pointer" }}
256-
onClick={handleReviewComplete}
257-
>
258-
<div className="text-wrapper-11">검토 완료</div>
248+
{activity.startDate >= minDate && activity.endDate <= maxDate && (
249+
<div className="frame-11">
250+
<SubTitle className="sub-title-instance" text="검토 결과" />
251+
<div className="frame-9">
252+
<textarea
253+
className="text-area"
254+
value={reviewResult}
255+
onChange={handleReviewResultChange}
256+
/>
257+
<div className="frame-14">
258+
<div
259+
className="frame-15"
260+
style={{ cursor: "pointer" }}
261+
onClick={handleReviewComplete}
262+
>
263+
<div className="text-wrapper-11">검토 완료</div>
264+
</div>
259265
</div>
266+
{renderActivityFeedback()}
260267
</div>
261-
{renderActivityFeedback()}
262268
</div>
263-
</div>
269+
)}
264270
</div>
265271
</div>
266272
<UnderBar />

0 commit comments

Comments
 (0)